Ignore:
File:
1 edited

Legend:

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

    r0f4f1b2 rb169619  
    4343#define THREADS      8
    4444
     45static atomic_size_t thread_cnt;
    4546static atomic_size_t thread_fail;
    4647
     
    5556                    "Unable to allocate frames\n", THREAD->tid, CPU->id);
    5657                atomic_inc(&thread_fail);
     58                atomic_dec(&thread_cnt);
    5759                return;
    5860        }
     
    106108        TPRINTF("Thread #%" PRIu64 " (cpu%u): Exiting\n",
    107109            THREAD->tid, CPU->id);
     110        atomic_dec(&thread_cnt);
    108111}
    109112
    110113const char *test_falloc2(void)
    111114{
     115        atomic_store(&thread_cnt, THREADS);
    112116        atomic_store(&thread_fail, 0);
    113 
    114         thread_t *threads[THREADS] = { };
    115117
    116118        for (unsigned int i = 0; i < THREADS; i++) {
     
    121123                        break;
    122124                }
    123                 thread_start(thrd);
    124                 threads[i] = thrd;
     125                thread_ready(thrd);
    125126        }
    126127
    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);
    132132        }
    133133
Note: See TracChangeset for help on using the changeset viewer.