Changes in kernel/test/mm/falloc2.c [b169619:0f4f1b2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/test/mm/falloc2.c
rb169619 r0f4f1b2 43 43 #define THREADS 8 44 44 45 static atomic_size_t thread_cnt;46 45 static atomic_size_t thread_fail; 47 46 … … 56 55 "Unable to allocate frames\n", THREAD->tid, CPU->id); 57 56 atomic_inc(&thread_fail); 58 atomic_dec(&thread_cnt);59 57 return; 60 58 } … … 108 106 TPRINTF("Thread #%" PRIu64 " (cpu%u): Exiting\n", 109 107 THREAD->tid, CPU->id); 110 atomic_dec(&thread_cnt);111 108 } 112 109 113 110 const char *test_falloc2(void) 114 111 { 115 atomic_store(&thread_cnt, THREADS);116 112 atomic_store(&thread_fail, 0); 113 114 thread_t *threads[THREADS] = { }; 117 115 118 116 for (unsigned int i = 0; i < THREADS; i++) { … … 123 121 break; 124 122 } 125 thread_ready(thrd); 123 thread_start(thrd); 124 threads[i] = thrd; 126 125 } 127 126 128 while (atomic_load(&thread_cnt) > 0) { 129 TPRINTF("Threads left: %zu\n", 130 atomic_load(&thread_cnt)); 131 thread_sleep(1); 127 for (unsigned int i = 0; i < THREADS; i++) { 128 if (threads[i] != NULL) 129 thread_join(threads[i]); 130 131 TPRINTF("Threads left: %u\n", THREADS - i - 1); 132 132 } 133 133
Note:
See TracChangeset
for help on using the changeset viewer.