7 #include "linuxrwlocks-wildcard.h"
14 static void a(void *obj)
17 atomic_store_explicit(&x, 17, relaxed);
18 write_unlock(&mylock);
20 if (!read_can_lock(&mylock))
22 if (read_trylock(&mylock)) {
23 atomic_load_explicit(&x, relaxed);
28 static void b(void *obj)
31 if (write_trylock(&mylock)) {
32 atomic_store_explicit(&x, 16, relaxed);
33 write_unlock(&mylock);
37 atomic_load_explicit(&x, relaxed);
41 int user_main(int argc, char **argv)
44 atomic_init(&mylock.lock, RW_LOCK_BIAS);
48 thrd_create(&t1, (thrd_start_t)&a, NULL);
49 thrd_create(&t2, (thrd_start_t)&b, NULL);