Changeset 508b0df1 in mainline for uspace/app/tester
- 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)
- Location:
- uspace/app/tester
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/float/float1.c
r4621d23 r508b0df1 32 32 #include <stdlib.h> 33 33 #include <stddef.h> 34 #include < atomic.h>34 #include <stdatomic.h> 35 35 #include <fibril.h> 36 36 #include <fibril_synch.h> … … 45 45 46 46 static FIBRIL_SEMAPHORE_INITIALIZE(threads_finished, 0); 47 static atomic_ t threads_fault;47 static atomic_int threads_fault; 48 48 49 49 static errno_t e(void *data) … … 60 60 61 61 if ((uint32_t) (e * PRECISION) != E_10E8) { 62 atomic_ inc(&threads_fault);62 atomic_fetch_add(&threads_fault, 1); 63 63 break; 64 64 } … … 71 71 const char *test_float1(void) 72 72 { 73 atomic_count_t total = 0;73 int total = 0; 74 74 75 atomic_s et(&threads_fault, 0);75 atomic_store(&threads_fault, 0); 76 76 fibril_test_spawn_runners(THREADS); 77 77 … … 92 92 TPRINTF("\n"); 93 93 94 for ( unsignedint i = 0; i < total; i++) {95 TPRINTF("Threads left: % " PRIua "\n", total - i);94 for (int i = 0; i < total; i++) { 95 TPRINTF("Threads left: %d\n", total - i); 96 96 fibril_semaphore_down(&threads_finished); 97 97 } 98 98 99 if (atomic_ get(&threads_fault) == 0)99 if (atomic_load(&threads_fault) == 0) 100 100 return NULL; 101 101 -
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.