---
name: "ares_threadsafety"
section: "3"
platform: "linux"
package: "c-ares"
version: "1.34.9-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ares_threadsafety"
---

# ares\_threadsafety(3)

Query if c-ares was built with thread-safety

## NAME

ares\_threadsafety - Query if c-ares was built with thread-safety

## SYNOPSIS

```
#include <ares.h>
ares_bool_t ares_threadsafety(void);
```

## DESCRIPTION

The **[ares\_threadsafety(3)](/ares_threadsafety/3.md)** function returns if the library was built with thread safety enabled or not.

As of c-ares 1.23.0, this simply means that every public function which references an *ares\_channel\_t* object will lock the channel on entry and release the lock on exit of the function.  This will prevent concurrent thread access to the channel, thus ensuring no corruption can occur.

As of c-ares 1.26.0, this also indicates if **ARES\_OPT\_EVENT\_THREAD** can be passed to *[ares\_init\_options(3)](/ares_init_options/3.md)*.

## RETURN VALUES

*[ares\_threadsafety(3)](/ares_threadsafety/3.md)* can return any of the following values:

- **ARES\_TRUE**

  Built with thread safety.

- **ARES\_FALSE**

  Built without thread safety

- This function was first introduced in c-ares version 1.23.0.

  ## AVAILABILITY

## SEE ALSO

[**ares\_init**(3)](/ares_init/3.md), [**ares\_init\_options**(3)](/ares_init_options/3.md), [**ares\_destroy**(3)](/ares_destroy/3.md), [**ares\_dup**(3)](/ares_dup/3.md), [**ares\_library\_init**(3)](/ares_library_init/3.md), [**ares\_set\_servers**(3)](/ares_set_servers/3.md)
