diff --git a/include/ck_rwlock.h b/include/ck_rwlock.h index 09b5a64..18c7b4c 100644 --- a/include/ck_rwlock.h +++ b/include/ck_rwlock.h @@ -59,6 +59,7 @@ ck_rwlock_write_lock(ck_rwlock_t *rw) while (ck_pr_load_uint(&rw->n_readers) != 0) ck_pr_stall(); + ck_pr_fence_store(); return; } @@ -66,6 +67,7 @@ CK_CC_INLINE static void ck_rwlock_write_unlock(ck_rwlock_t *rw) { + ck_pr_fence_store(); ck_pr_store_uint(&rw->writer, false); return; } @@ -84,6 +86,7 @@ ck_rwlock_read_lock(ck_rwlock_t *rw) ck_pr_dec_uint(&rw->n_readers); } + ck_pr_fence_load(); return; } @@ -91,6 +94,7 @@ CK_CC_INLINE static void ck_rwlock_read_unlock(ck_rwlock_t *rw) { + ck_pr_fence_load(); ck_pr_dec_uint(&rw->n_readers); return; }