diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index 80559bafdefd..f80cb15e6b71 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -2853,6 +2853,8 @@ do_sem_wait(struct thread *td, struct _usem *sem, struct timespec *timeout) umtxq_insert(uq); umtxq_unlock(&uq->uq_key); + suword32(__DEVOLATILE(uint32_t *, &sem->_has_waiters), 1); + count = fuword32(__DEVOLATILE(uint32_t *, &sem->_count)); if (count != 0) { umtxq_lock(&uq->uq_key); @@ -2863,11 +2865,6 @@ do_sem_wait(struct thread *td, struct _usem *sem, struct timespec *timeout) return (0); } - /* - * set waiters byte and sleep. - */ - suword32(__DEVOLATILE(uint32_t *, &sem->_has_waiters), 1); - umtxq_lock(&uq->uq_key); umtxq_unbusy(&uq->uq_key); umtxq_unlock(&uq->uq_key);