7 ms·
It's not just libc, it's any C or C++ library that calls getenv or setenv.
by jcotton42 2y ago
It's not just libc, it's any C or C++ library that calls getenv or setenv.
- rerdavies 2y agoSpecifically, any C or C++ library that calls setenv (despite documentation that says that setenv is not threadsafe).
- SAI_Peregrinus 2y agoOr any multithreaded program that uses a C or C++ library that calls setenv somewhere internally, and failed to document that it does so and is thus unsuitable for use by multithreaded programs. No library does that documentation, so you can't use libraries on POSIX systems if writing multithreaded code. Or you do and hope for the best. So everyone just hopes for the best.
- rerdavies 2y agoThe documentation for setenv: Caveats: POSIX.1 does not require setenv() or unsetenv() to be reentrant. ... Interface: setenv(), unsetenv() Attribute: Thread safety Value: MT-Unsafe const:env Libraries that are thread-safe DO provide that documentation. One assumes that libraries that don't provide that documentation are not thread=safe. GnuTLS docs: The GnuTLS library is thread safe by design, meaning that objects of the library such as TLS sessions, can be safely divided across threads as long as a single thread accesses a single object.