[libcxx] r240527 - Make support for thread-unsafe C functions optional.

Joerg Sonnenberger joerg at britannica.bec.de
Wed Jun 24 04:19:40 PDT 2015


On Wed, Jun 24, 2015 at 08:44:39AM -0000, Ed Schouten wrote:
> The following patch adds a knob to libc++,
> _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS, that can be set to disable
> thread-unsafe functions that can easily be avoided in practice. The
> following functions are not thread-safe:
> 
> - <clocale>: locale handles should be preferred over setlocale().

Note that setlocale() *is* thread-safe on a correctly implemented UNIX.
It is a bug if you don't get consistent results with a clear
before-after semantic even when other threads call locale-sensitive
funcctions concurrently.

Joerg



More information about the cfe-commits mailing list