Lines Matching defs:channel
504 ares_status_t ares__channel_threading_init(ares_channel_t *channel)
513 channel->lock = ares__thread_mutex_create();
514 if (channel->lock == NULL) {
519 channel->cond_empty = ares__thread_cond_create();
520 if (channel->cond_empty == NULL) {
527 ares__channel_threading_destroy(channel);
532 void ares__channel_threading_destroy(ares_channel_t *channel)
534 ares__thread_mutex_destroy(channel->lock);
535 channel->lock = NULL;
536 ares__thread_cond_destroy(channel->cond_empty);
537 channel->cond_empty = NULL;
540 void ares__channel_lock(ares_channel_t *channel)
542 ares__thread_mutex_lock(channel->lock);
545 void ares__channel_unlock(ares_channel_t *channel)
547 ares__thread_mutex_unlock(channel->lock);
550 /* Must not be holding a channel lock already, public function only */
551 ares_status_t ares_queue_wait_empty(ares_channel_t *channel, int timeout_ms)
560 if (channel == NULL) {
570 ares__thread_mutex_lock(channel->lock);
571 while (ares__llist_len(channel->all_queries)) {
573 ares__thread_cond_wait(channel->cond_empty, channel->lock);
586 ares__thread_cond_timedwait(channel->cond_empty, channel->lock, tms);
590 ares__thread_mutex_unlock(channel->lock);
594 void ares_queue_notify_empty(ares_channel_t *channel)
596 if (channel == NULL) {
600 /* We are guaranteed to be holding a channel lock already */
601 if (ares__llist_len(channel->all_queries)) {
606 ares__thread_cond_broadcast(channel->cond_empty);