ck_rwlock: Add publish semantics for rwlock.

ck_pring
Samy Al Bahra 14 years ago
parent 43519250f5
commit 16c86b98e5

@ -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;
}

Loading…
Cancel
Save