7 #include "linuxrwlocks-wildcard.h"
14 static void a(void *obj)
16 if (!write_can_lock(&mylock))
19 if (write_trylock(&mylock)) {
20 atomic_store_explicit(&x, 17, relaxed);
21 write_unlock(&mylock);
25 static void b(void *obj)
27 if (write_trylock(&mylock)) {
28 atomic_store_explicit(&x, 16, relaxed);
29 write_unlock(&mylock);
32 if (!read_can_lock(&mylock))
34 if (read_trylock(&mylock)) {
35 atomic_load_explicit(&x, relaxed);
40 int user_main(int argc, char **argv)
43 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);