ck_swlock: make ck_swlock_recursive_write_unlatch() wait-free.

ck_pring
Jaidev Sridhar 11 years ago
parent ca70ce684c
commit 15a0485c01

@ -334,14 +334,8 @@ ck_swlock_recursive_write_unlock(ck_swlock_recursive_t *rw)
CK_CC_INLINE static void CK_CC_INLINE static void
ck_swlock_recursive_write_unlatch(ck_swlock_recursive_t *rw) ck_swlock_recursive_write_unlatch(ck_swlock_recursive_t *rw)
{ {
uint32_t snapshot = ck_pr_load_32(&rw->rw.n_readers);
uint32_t delta = snapshot & CK_SWLOCK_READER_BITS;
while (ck_pr_cas_32_value(&rw->rw.n_readers, snapshot, delta, &snapshot) == false) {
delta = snapshot & CK_SWLOCK_READER_BITS;
ck_pr_stall();
}
ck_pr_and_32(&rw->rw.n_readers, CK_SWLOCK_READER_BITS);
ck_swlock_recursive_write_unlock(rw); ck_swlock_recursive_write_unlock(rw);
return; return;
} }

Loading…
Cancel
Save