Changeset 38d8849 in mainline for uspace/app/tester/float/float1.c
- Timestamp:
- 2018-07-16T15:58:51Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- db51219f
- Parents:
- c124c985
- git-author:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-07-14 16:53:46)
- git-committer:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-07-16 15:58:51)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tester/float/float1.c
rc124c985 r38d8849 33 33 #include <stddef.h> 34 34 #include <atomic.h> 35 #include <thread.h> 35 #include <fibril.h> 36 #include <fibril_synch.h> 36 37 #include <inttypes.h> 37 38 #include "../tester.h" … … 43 44 #define PRECISION 100000000 44 45 45 static atomic_t threads_finished;46 static FIBRIL_SEMAPHORE_INITIALIZE(threads_finished, 0); 46 47 static atomic_t threads_fault; 47 48 48 static voide(void *data)49 static errno_t e(void *data) 49 50 { 50 51 for (unsigned int i = 0; i < ATTEMPTS; i++) { … … 64 65 } 65 66 66 atomic_inc(&threads_finished); 67 fibril_semaphore_up(&threads_finished); 68 return EOK; 67 69 } 68 70 … … 71 73 atomic_count_t total = 0; 72 74 73 atomic_set(&threads_finished, 0);74 75 atomic_set(&threads_fault, 0); 76 fibril_test_spawn_runners(THREADS); 75 77 76 78 TPRINTF("Creating threads"); 77 79 for (unsigned int i = 0; i < THREADS; i++) { 78 if (thread_create(e, NULL, "e", NULL) != EOK) { 80 fid_t f = fibril_create(e, NULL); 81 if (!f) { 79 82 TPRINTF("\nCould not create thread %u\n", i); 80 83 break; 81 84 } 85 fibril_detach(f); 86 fibril_add_ready(f); 82 87 83 88 TPRINTF("."); … … 87 92 TPRINTF("\n"); 88 93 89 while (atomic_get(&threads_finished) < total) { 90 TPRINTF("Threads left: %" PRIua "\n", 91 total - atomic_get(&threads_finished)); 92 thread_sleep(1); 94 for (unsigned int i = 0; i < total; i++) { 95 TPRINTF("Threads left: %" PRIua "\n", total - i); 96 fibril_semaphore_down(&threads_finished); 93 97 } 94 98
Note:
See TracChangeset
for help on using the changeset viewer.