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.33
Jiwoo Park 3 months ago committed by Brad House
parent 0b80ed1735
commit 15883a95f2
  1. 8
      src/lib/event/ares_event_thread.c

@ -326,13 +326,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