4 ms·
Good point. There are multiple levels of "safety". I think glibc API does a decent job marking and indicating which is which: https://sourceware.org/glibc/manu
by rdtsc 2y ago
Good point. There are multiple levels of "safety". I think glibc API does a decent job marking and indicating which is which:
https://sourceware.org/glibc/manual/2.40/html_node/POSIX-Safety-Concepts.html https://sourceware.org/glibc/manual/2.40/html_node/POSIX-Saf...
Thread-Safe
Async-Signal-Safe
Async-Cancel-Safe (mostly limited to pthread_*cancel*)
There is a host of other "safety" remarks also useful to keep in mind: https://sourceware.org/glibc/manual/2.40/html_node/Other-Safety-Remarks.html https://sourceware.org/glibc/manual/2.40/html_node/Other-Saf...
- kragen 2y agothis isn't about safety, though; hcreate() and hsearch() don't support having two hash tables in the same process at the same time, not even in an unsafe way. that also makes them non-reentrant, but that isn't the main problem!