4 #include "model-assert.h"
7 #include "stack_wildcard.h"
15 unsigned int idx1, idx2;
21 static void main_task(void *param)
24 int pid = *((int *)param);
27 atomic_store_explicit(&x[1], 17, relaxed);
28 } else if (pid % 4 == 1) {
29 atomic_store_explicit(&x[2], 37, relaxed);
31 } else if (pid % 4 == 2) {
34 a = atomic_load_explicit(&x[idx1], relaxed);
39 b = atomic_load_explicit(&x[idx2], relaxed);
44 int user_main(int argc, char **argv)
49 atomic_init(&x[1], 0);
50 atomic_init(&x[2], 0);
56 param = new int[num_threads];
57 thrd_t *threads = new thrd_t[num_threads];
59 for (i = 0; i < num_threads; i++) {
61 thrd_create(&threads[i], main_task, ¶m[i]);
63 for (i = 0; i < num_threads; i++)
64 thrd_join(threads[i]);