Changes in kernel/test/mm/slab1.c [0f4f1b2:b169619] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/test/mm/slab1.c
r0f4f1b2 rb169619 121 121 static void *thr_data[THREADS][THR_MEM_COUNT]; 122 122 static slab_cache_t *thr_cache; 123 static semaphore_t thr_sem; 123 124 124 125 static void slabtest(void *data) … … 141 142 142 143 TPRINTF("Thread #%" PRIu64 " finished\n", THREAD->tid); 144 145 semaphore_up(&thr_sem); 143 146 } 144 147 145 148 static void testthreads(void) 146 149 { 150 thread_t *t; 151 int i; 152 147 153 thr_cache = slab_cache_create("thread_cache", THR_MEM_SIZE, 0, NULL, NULL, 148 154 SLAB_CACHE_NOMAGAZINE); 149 155 150 thread_t *threads[THREADS] = { }; 151 152 for (int i = 0; i < THREADS; i++) { 153 threads[i] = thread_create(slabtest, (void *) (sysarg_t) i, 154 TASK, THREAD_FLAG_NONE, "slabtest"); 155 if (threads[i]) { 156 thread_start(threads[i]); 157 } else { 156 semaphore_initialize(&thr_sem, 0); 157 for (i = 0; i < THREADS; i++) { 158 if (!(t = thread_create(slabtest, (void *) (sysarg_t) i, TASK, THREAD_FLAG_NONE, "slabtest"))) { 158 159 TPRINTF("Could not create thread %d\n", i); 159 } 160 } else 161 thread_ready(t); 160 162 } 161 163 162 for (int i = 0; i < THREADS; i++) { 163 if (threads[i] != NULL) 164 thread_join(threads[i]); 165 } 164 for (i = 0; i < THREADS; i++) 165 semaphore_down(&thr_sem); 166 166 167 167 slab_cache_destroy(thr_cache);
Note:
See TracChangeset
for help on using the changeset viewer.