6 #include "linuxrwlocks.h"
13 static void a(void *obj)
15 if (!write_can_lock(&mylock))
18 if (write_trylock(&mylock)) {
19 // atomic_store_explicit(&x, 17, memory_order_relaxed);
20 write_unlock(&mylock);
24 static void b(void *obj)
26 if (write_trylock(&mylock)) {
27 //atomic_store_explicit(&x, 16, memory_order_relaxed);
28 write_unlock(&mylock);
31 if (!read_can_lock(&mylock))
33 if (read_trylock(&mylock)) {
34 // atomic_load_explicit(&x, memory_order_relaxed);
39 int user_main(int argc, char **argv)
42 atomic_init(&mylock.lock, RW_LOCK_BIAS);
47 thrd_create(&t1, (thrd_start_t)&a, NULL);
48 thrd_create(&t2, (thrd_start_t)&b, NULL);