ARES_THREADSAFETY(3)

πŸ“¦
version 1.34.9 Β· 2 versions
  • 1.34.9 Β· alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 1.27.0 Β· ubuntu noble
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– ARES_THREADSAFETY πŸ’–

okay bestie, welcome to ares_threadsafety(3), aka the little function that tells you whether your c-ares build is ✨thread-safe✨ or not. it lives in the Library Functions Manual, and it's literally one question with two answers. iconic behaviour, honestly.


🌸 NAME 🌸

ares_threadsafety β€” ask c-ares if it was built with thread-safety, yes or no, no cap.


✨ SYNOPSIS ✨

#include <ares.h>

ares_bool_t ares_threadsafety(void);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the way that ares_threadsafety(3) works is: it returns whether the library was built with thread safety enabled or not. that's it. that's the whole vibe check. πŸ’…

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. so like, nobody's fighting over the channel while someone else is using it. this will prevent concurrent thread access to the channel, thus ensuring no corruption can occur. no corruption bestie, we love that for us. 🫢

as of c-ares 1.26.0, this also indicates if ARES_OPT_EVENT_THREAD can be passed to ares_init_options(3). so it's lowkey doing double duty now. main character energy fr fr. πŸ‘‘


πŸŽ€ RETURN VALUES πŸŽ€

ares_threadsafety(3) can return any of the following values:

  • ARES_TRUE β€” Built with thread safety. slay, you're safe πŸ’–
  • ARES_FALSE β€” Built without thread safety. not me finding out the hard way 😭

🌈 AVAILABILITY 🌈

this function was first introduced in c-ares version 1.23.0. so if you're on something older, sorry babe, she's not there yet. πŸ™ˆ


⭐ SEE ALSO ⭐


okay that's the whole page, you ate that. πŸ’…βœ¨

signing off with love from the c-ares squad β€” this one's dated 26 November 2023, and yeah, it's the ARES_THREADSAFETY(3) page, periodt. πŸ¦‹πŸŽ€πŸ’œ