8441972702762d0ab33aef89f5ca9c435331fae8
[model-checker-benchmarks.git] / seqlock / testcase1.c
1 #include <stdatomic.h>
2 #include <threads.h>
3
4 #include "seqlock-wildcard.h"
5
6 seqlock_t *lock;
7
8 static void a(void *obj) {
9         lock->write(3);
10 }
11
12 static void b(void *obj) {
13         lock->write(2);
14 }
15
16 static void c(void *obj) {
17         lock->write(2);
18         int r1 = lock->read();
19 }
20
21 int user_main(int argc, char **argv) {
22         thrd_t t1, t2, t3, t4;
23         lock = new seqlock_t();
24
25         thrd_create(&t1, (thrd_start_t)&a, NULL);
26         //thrd_create(&t2, (thrd_start_t)&b, NULL);
27         thrd_create(&t3, (thrd_start_t)&c, NULL);
28
29         thrd_join(t1);
30         //thrd_join(t2);
31         thrd_join(t3);
32         return 0;
33 }