check for spurious wakeup

pull/746/head
Brad House 10 months ago
parent 13f677a6f3
commit d9f513a5a4
  1. 6
      src/lib/ares__threads.c

@ -586,11 +586,13 @@ ares_status_t ares_queue_wait_empty(ares_channel_t *channel, int timeout_ms)
ares__thread_cond_timedwait(channel->cond_empty, channel->lock, tms);
}
/* Either there was a timeout or we were signaled that the queue was
* empty. Don't loop */
/* If there was a timeout, don't loop. Otherwise, make sure this wasn't
* a spurious wakeup by looping and checking the condition. */
if (status == ARES_ETIMEOUT) {
break;
}
}
}
ares__thread_mutex_unlock(channel->lock);
return status;
}

Loading…
Cancel
Save