Eliminate branch and insert an explicit reader memory barrier to ensure
that waiter bit is set before reading semaphore count.
This commit is contained in:
parent
c3eb99c02f
commit
0483748480
@ -2804,9 +2804,8 @@ do_sem_wait(struct thread *td, struct _usem *sem, struct timespec *timeout)
|
||||
umtxq_insert(uq);
|
||||
umtxq_unlock(&uq->uq_key);
|
||||
|
||||
if (fuword32(__DEVOLATILE(uint32_t *, &sem->_has_waiters)) == 0)
|
||||
casuword32(__DEVOLATILE(uint32_t *, &sem->_has_waiters), 0, 1);
|
||||
|
||||
casuword32(__DEVOLATILE(uint32_t *, &sem->_has_waiters), 0, 1);
|
||||
rmb();
|
||||
count = fuword32(__DEVOLATILE(uint32_t *, &sem->_count));
|
||||
if (count != 0) {
|
||||
umtxq_lock(&uq->uq_key);
|
||||
|
Loading…
x
Reference in New Issue
Block a user