Changeset f2cb80a in mainline for kernel/test/mm/slab1.c


Ignore:
Timestamp:
2024-02-23T17:57:23Z (15 months ago)
Author:
GitHub <noreply@…>
Children:
192019f
Parents:
86f862c (diff), 90ba06c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
boba-buba <120932204+boba-buba@…> (2024-02-23 17:57:23)
git-committer:
GitHub <noreply@…> (2024-02-23 17:57:23)
Message:

Merge branch 'HelenOS:master' into topic/packet-capture

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/test/mm/slab1.c

    r86f862c rf2cb80a  
    121121static void *thr_data[THREADS][THR_MEM_COUNT];
    122122static slab_cache_t *thr_cache;
    123 static semaphore_t thr_sem;
    124123
    125124static void slabtest(void *data)
     
    142141
    143142        TPRINTF("Thread #%" PRIu64 " finished\n", THREAD->tid);
    144 
    145         semaphore_up(&thr_sem);
    146143}
    147144
    148145static void testthreads(void)
    149146{
    150         thread_t *t;
    151         int i;
    152 
    153147        thr_cache = slab_cache_create("thread_cache", THR_MEM_SIZE, 0, NULL, NULL,
    154148            SLAB_CACHE_NOMAGAZINE);
    155149
    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"))) {
     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 {
    159158                        TPRINTF("Could not create thread %d\n", i);
    160                 } else
    161                         thread_ready(t);
     159                }
    162160        }
    163161
    164         for (i = 0; i < THREADS; i++)
    165                 semaphore_down(&thr_sem);
     162        for (int i = 0; i < THREADS; i++) {
     163                if (threads[i] != NULL)
     164                        thread_join(threads[i]);
     165        }
    166166
    167167        slab_cache_destroy(thr_cache);
Note: See TracChangeset for help on using the changeset viewer.