ck_brlock: No need for explicit pipeline stall if writer is active.

ck_pring
Samy Al Bahra 13 years ago
parent 46af4d7d24
commit 8b0e83e6ab

@ -147,12 +147,13 @@ ck_brlock_read_lock(struct ck_brlock *br, struct ck_brlock_reader *reader)
while (ck_pr_load_uint(&br->writer) == true)
ck_pr_stall();
ck_pr_inc_uint(&reader->n_readers);
ck_pr_store_uint(&reader->n_readers, reader->n_readers + 1);
ck_pr_fence_strict_memory();
if (ck_pr_load_uint(&br->writer) == false)
break;
ck_pr_dec_uint(&reader->n_readers);
ck_pr_store_uint(&reader->n_readers, reader->n_readers - 1);
}
return;
@ -162,7 +163,7 @@ CK_CC_INLINE static void
ck_brlock_read_unlock(struct ck_brlock_reader *reader)
{
ck_pr_dec_uint(&reader->n_readers);
ck_pr_store_uint(&reader->n_readers, reader->n_readers - 1);
return;
}

Loading…
Cancel
Save