ARES\_QUEUE(3) Library Functions Manual ARES\_QUEUE(3)

# [NAME](#NAME)

ares\_queue\_wait\_empty, ares\_queue\_active\_queries - Functions for checking the c-ares queue status

# [SYNOPSIS](#SYNOPSIS)

```
#include <ares.h>
size_t ares_queue_active_queries(const ares_channel_t *channel);
ares_status_t ares_queue_wait_empty(ares_channel_t *channel,


                                    int timeout_ms);
```

# [DESCRIPTION](#DESCRIPTION)

The [**ares\_queue\_active\_queries(3)**](/man/os/c-ares/ares_queue_active_queries.3) function retrieves the total number of active queries pending answers from servers. Some c-ares requests may spawn multiple queries, such as [*ares\_getaddrinfo(3)*](/man/os/c-ares/ares_getaddrinfo.3) when using *AF\_UNSPEC*, which will be reflected in this number. The **channel** parameter must be set to an initialized channel.

The [**ares\_queue\_wait\_empty(3)**](/man/os/c-ares/ares_queue_wait_empty.3) function blocks until notified that there are no longer any queries in queue, or the specified timeout has expired. The **channel** parameter must be set to an initialized channel. The **timeout\_ms** parameter is the number of milliseconds to wait for the queue to be empty or -1 for Infinite.

# [RETURN VALUES](#RETURN_VALUES)

[*ares\_queue\_active\_queries(3)*](/man/os/c-ares/ares_queue_active_queries.3) returns the active query count.

[*ares\_queue\_wait\_empty(3)*](/man/os/c-ares/ares_queue_wait_empty.3) can return any of the following values:

[**ARES\_ENOTIMP**](#ARES_ENOTIMP)

if not built with threading support

[**ARES\_ETIMEOUT**](#ARES_ETIMEOUT)

if requested timeout expired

[**ARES\_SUCCESS**](#ARES_SUCCESS)

when queue is empty.

# [AVAILABILITY](#AVAILABILITY)

This function was first introduced in c-ares version 1.27.0, and requires the c-ares library to be built with threading support.

# [SEE ALSO](#SEE_ALSO)

[**ares\_init\_options**(3)](/man/os/c-ares/ares_init_options.3), [**ares\_threadsafety**(3)](/man/os/c-ares/ares_threadsafety.3)

16 February 2024

---

Document: ares_queue_wait_empty(3) from c-ares 1.34.9-r0 (Chainguard OS)
Source: https://github.com/c-ares/c-ares
