Changeset 508b0df1 in mainline for uspace/app/tester/thread/thread1.c
- Timestamp:
- 2018-09-06T20:21:52Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 78de83de, fc10e1b
- Parents:
- 4621d23
- git-author:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-08-13 03:53:39)
- git-committer:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-09-06 20:21:52)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/thread/thread1.c
r4621d23 r508b0df1 31 31 #define DELAY 10 32 32 33 #include < atomic.h>33 #include <stdatomic.h> 34 34 #include <errno.h> 35 35 #include <fibril.h> … … 40 40 #include "../tester.h" 41 41 42 static atomic_ tfinish;42 static atomic_bool finish; 43 43 44 44 static FIBRIL_SEMAPHORE_INITIALIZE(threads_finished, 0); … … 48 48 fibril_detach(fibril_get_id()); 49 49 50 while ( atomic_get(&finish))50 while (!atomic_load(&finish)) 51 51 fibril_usleep(100000); 52 52 … … 57 57 const char *test_thread1(void) 58 58 { 59 unsigned int i; 60 atomic_count_t total = 0; 59 int total = 0; 61 60 62 atomic_s et(&finish, 1);61 atomic_store(&finish, false); 63 62 64 63 fibril_test_spawn_runners(THREADS); 65 64 66 65 TPRINTF("Creating threads"); 67 for (i = 0; i < THREADS; i++) {66 for (int i = 0; i < THREADS; i++) { 68 67 fid_t f = fibril_create(threadtest, NULL); 69 68 if (!f) { … … 80 79 TPRINTF("\n"); 81 80 82 atomic_set(&finish, 0); 83 for (i = 0; i < total; i++) { 84 TPRINTF("Threads left: %" PRIua "\n", 85 total - i); 81 atomic_store(&finish, true); 82 for (int i = 0; i < total; i++) { 83 TPRINTF("Threads left: %d\n", total - i); 86 84 fibril_semaphore_down(&threads_finished); 87 85 }
Note:
See TracChangeset
for help on using the changeset viewer.