ares_threadsafety(3)

ares_threadsafety3

Query if c-ares was built with thread-safety

Usage

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

Overview

The ares_threadsafety(3) 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).

Return values

ares_threadsafety(3) 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.

Releases

Unchanged in 2 releases since Debian 13 (Trixie).

  1. 13–Arch

Availability

From c-ares 1.34.9-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.