Silence TSAN, lock before checking `ares_event_thread::isup` (#915)

TSAN is warning about a thread concurrency issue that doesn't actually matter if the operation isn't atomic as its an optimization in this code path to skip timeout processing if we're shutting down due to ares_destroy().

Fix By: Jiwoo Park (@jimmy-park)
v1.29
Jiwoo Park 3 weeks ago committed by Brad House
parent cb5f861a08
commit 10b7bc7034
  1. 8
      src/lib/ares_event_thread.c

@ -328,13 +328,15 @@ static void *ares_event_thread(void *arg)
e->ev_sys->wait(e, timeout_ms);
/* Relock before we loop again */
ares_thread_mutex_lock(e->mutex);
/* Each iteration should do timeout processing */
if (e->isup) {
ares_thread_mutex_unlock(e->mutex);
ares_process_fd(e->channel, ARES_SOCKET_BAD, ARES_SOCKET_BAD);
ares_thread_mutex_lock(e->mutex);
}
/* Relock before we loop again */
ares__thread_mutex_lock(e->mutex);
}
/* Lets cleanup while we're in the thread itself */

Loading…
Cancel
Save