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