|
|
@ -93,7 +93,7 @@ ck_bytelock_write_lock(struct ck_bytelock *bytelock, unsigned int slot)
|
|
|
|
ck_pr_store_8(&bytelock->readers[slot - 1], false);
|
|
|
|
ck_pr_store_8(&bytelock->readers[slot - 1], false);
|
|
|
|
|
|
|
|
|
|
|
|
/* Wait for slotted readers to drain out. */
|
|
|
|
/* Wait for slotted readers to drain out. */
|
|
|
|
ck_pr_fence_strict_memory();
|
|
|
|
ck_pr_fence_store_load();
|
|
|
|
for (i = 0; i < sizeof(bytelock->readers) / CK_BYTELOCK_LENGTH; i++) {
|
|
|
|
for (i = 0; i < sizeof(bytelock->readers) / CK_BYTELOCK_LENGTH; i++) {
|
|
|
|
while (CK_BYTELOCK_LOAD((CK_BYTELOCK_TYPE *)&readers[i]) != false)
|
|
|
|
while (CK_BYTELOCK_LOAD((CK_BYTELOCK_TYPE *)&readers[i]) != false)
|
|
|
|
ck_pr_stall();
|
|
|
|
ck_pr_stall();
|
|
|
@ -150,7 +150,7 @@ ck_bytelock_read_lock(struct ck_bytelock *bytelock, unsigned int slot)
|
|
|
|
slot -= 1;
|
|
|
|
slot -= 1;
|
|
|
|
for (;;) {
|
|
|
|
for (;;) {
|
|
|
|
ck_pr_store_8(&bytelock->readers[slot], true);
|
|
|
|
ck_pr_store_8(&bytelock->readers[slot], true);
|
|
|
|
ck_pr_fence_strict_memory();
|
|
|
|
ck_pr_fence_store_load();
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* If there is no owner at this point, our slot has
|
|
|
|
* If there is no owner at this point, our slot has
|
|
|
|