diff --git a/src/ev_evports.c b/src/ev_evports.c index 09a48a4d9..9dc5728c6 100644 --- a/src/ev_evports.c +++ b/src/ev_evports.c @@ -152,8 +152,6 @@ static void _do_poll(struct poller *p, int exp, int wake) } thread_harmless_now(); - if (sleeping_thread_mask & tid_bit) - _HA_ATOMIC_AND(&sleeping_thread_mask, ~tid_bit); /* * Determine how long to wait for events to materialise on the port. @@ -206,6 +204,8 @@ static void _do_poll(struct poller *p, int exp, int wake) tv_leaving_poll(wait_time, nevlist); thread_harmless_end(); + if (sleeping_thread_mask & tid_bit) + _HA_ATOMIC_AND(&sleeping_thread_mask, ~tid_bit); if (nevlist > 0) activity[tid].poll_io++; diff --git a/src/ev_poll.c b/src/ev_poll.c index 4ed1b9e84..f973d08bc 100644 --- a/src/ev_poll.c +++ b/src/ev_poll.c @@ -165,8 +165,6 @@ static void _do_poll(struct poller *p, int exp, int wake) } while (!_HA_ATOMIC_CAS(&maxfd, &old_maxfd, new_maxfd)); thread_harmless_now(); - if (sleeping_thread_mask & tid_bit) - _HA_ATOMIC_AND(&sleeping_thread_mask, ~tid_bit); fd_nbupdt = 0; @@ -210,6 +208,8 @@ static void _do_poll(struct poller *p, int exp, int wake) tv_leaving_poll(wait_time, status); thread_harmless_end(); + if (sleeping_thread_mask & tid_bit) + _HA_ATOMIC_AND(&sleeping_thread_mask, ~tid_bit); if (status > 0) activity[tid].poll_io++;