changes
[model-checker-benchmarks.git] / seqlock / seqlock.c
1 #include <stdatomic.h>
2 #include <threads.h>
3
4 #include "seqlock.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         int r1 = lock->read();
18 }
19
20 int user_main(int argc, char **argv) {
21         thrd_t t1, t2, t3, t4;
22         lock = new seqlock_t();
23
24         thrd_create(&t1, (thrd_start_t)&a, NULL);
25         //thrd_create(&t2, (thrd_start_t)&b, NULL);
26         thrd_create(&t3, (thrd_start_t)&c, NULL);
27
28         thrd_join(t1);
29         //thrd_join(t2);
30         thrd_join(t3);
31         return 0;
32 }