From 16c86b98e5cd679748d42b4092daae726bf208a6 Mon Sep 17 00:00:00 2001 From: Samy Al Bahra Date: Sun, 19 Jun 2011 14:08:57 -0400 Subject: [PATCH] ck_rwlock: Add publish semantics for rwlock. --- include/ck_rwlock.h | 4 ++++ 1 file changed, 4 insertions(+) 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; }