Changes in kernel/test/mm/falloc2.c [31e15be:0f4f1b2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/test/mm/falloc2.c
r31e15be r0f4f1b2 35 35 #include <atomic.h> 36 36 #include <proc/thread.h> 37 #include <mem .h>37 #include <memw.h> 38 38 #include <arch.h> 39 39 … … 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 } 61 62 thread_detach(THREAD);63 59 64 60 for (unsigned int run = 0; run < THREAD_RUNS; run++) { … … 110 106 TPRINTF("Thread #%" PRIu64 " (cpu%u): Exiting\n", 111 107 THREAD->tid, CPU->id); 112 atomic_dec(&thread_cnt);113 108 } 114 109 115 110 const char *test_falloc2(void) 116 111 { 117 atomic_store(&thread_cnt, THREADS);118 112 atomic_store(&thread_fail, 0); 113 114 thread_t *threads[THREADS] = { }; 119 115 120 116 for (unsigned int i = 0; i < THREADS; i++) { … … 125 121 break; 126 122 } 127 thread_ready(thrd); 123 thread_start(thrd); 124 threads[i] = thrd; 128 125 } 129 126 130 while (atomic_load(&thread_cnt) > 0) { 131 TPRINTF("Threads left: %zu\n", 132 atomic_load(&thread_cnt)); 133 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); 134 132 } 135 133
Note:
See TracChangeset
for help on using the changeset viewer.