7 #include "linuxrwlocks-wildcard.h"
14 static void a(void *obj)
17 atomic_store_explicit(&x, 17, relaxed);
18 write_unlock(&mylock);
22 if (!write_can_lock(&mylock))
25 if (write_trylock(&mylock)) {
26 atomic_store_explicit(&x, 17, relaxed);
27 write_unlock(&mylock);
32 static void b(void *obj)
36 atomic_store_explicit(&x, 16, relaxed);
37 write_unlock(&mylock);
40 atomic_load_explicit(&x, relaxed);
44 if (write_trylock(&mylock)) {
45 atomic_store_explicit(&x, 16, relaxed);
46 write_unlock(&mylock);
49 if (!read_can_lock(&mylock))
51 if (read_trylock(&mylock)) {
52 atomic_load_explicit(&x, relaxed);
58 int user_main(int argc, char **argv)
61 atomic_init(&mylock.lock, RW_LOCK_BIAS);
65 thrd_create(&t1, (thrd_start_t)&a, NULL);
66 thrd_create(&t2, (thrd_start_t)&b, NULL);