15 static void main_task(void *param)
18 int pid = *((int *)param);
21 } else if (pid % 3 == 1) {
23 } else if (pid % 3 == 2) {
28 int user_main(int argc, char **argv)
33 atomic_init(&x[1], 0);
34 atomic_init(&x[2], 0);
41 param = new int[num_threads];
42 thrd_t *threads = new thrd_t[num_threads];
44 for (i = 0; i < num_threads; i++) {
46 thrd_create(&threads[i], main_task, ¶m[i]);
48 for (i = 0; i < num_threads; i++)
49 thrd_join(threads[i]);