MCPcopy Create free account
hub / github.com/HelenOS/helenos / test_thread1

Function test_thread1

kernel/test/thread/thread1.c:53–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

51}
52
53const char *test_thread1(void)
54{
55 unsigned int i;
56 size_t total = 0;
57
58 atomic_store(&finish, true);
59 atomic_store(&threads_finished, 0);
60
61 for (i = 0; i < THREADS; i++) {
62 thread_t *t;
63 if (!(t = thread_create(threadtest, NULL, TASK,
64 THREAD_FLAG_NONE, "threadtest"))) {
65 TPRINTF("Could not create thread %d\n", i);
66 break;
67 }
68 thread_ready(t);
69 total++;
70 }
71
72 TPRINTF("Running threads for 10 seconds...\n");
73 thread_sleep(10);
74
75 atomic_store(&finish, false);
76 while (atomic_load(&threads_finished) < total) {
77 TPRINTF("Threads left: %zu\n", total - atomic_load(&threads_finished));
78 thread_sleep(1);
79 }
80
81 return NULL;
82}

Callers

nothing calls this directly

Calls 3

thread_readyFunction · 0.85
thread_createFunction · 0.50
thread_sleepFunction · 0.50

Tested by

no test coverage detected