ISO/IEC JTC1 SC22 WG21 N2827 = 09-0017 - 2009-02-07
Lawrence Crowl, crowl@google.com, Lawrence@Crowl.org
P.J. Plauger, pjp@dinkumware.com
Nick Stoughton, USENIX, nick@usenix.org
With the introduction of concurrency into the C++ standard, some functions adopted from the C standard need explicit exemption from the general prohibition on data races in 17.6.5.7 [res.on.data.races].
The following functions are already exempted in 20.9 [date.time].
asctime ctime gmtime localtime
The following functions are already exempted in 21.5 [c.strings].
strerror strtok
The following functions are already exempted in 26.7 [c.math].
rand
The following functions may have previously been thread unsafe, but must be thread safe to enable effective programming.
atexit at_quick_exit exit fclose free quick_exit malloc signal
After paragraph 4, add a new paragraph.
The function
getenv
is not required to avoid data races (17.6.5.7).
After paragraph 14, add a new paragraph.
The following functions are not required to avoid data races (17.6.5.7) if the
mbstate_t*
argument isNULL
.
mbrlen mbrtowc mbsrtowc mbtowc wcrtomb wcsrtomb wctomb
Edit paragraph 2 as follows.
Effects: Causes future calls to the constructor
locale()
to return a copy of the argument. If the argument has a name, does
std::setlocale(LC_ALL, loc.name().c_str());
otherwise, the effect on the C locale, if any, is implementation-defined. No library function other than
locale::global()
shall affect the value returned bylocale()
. [Note: See (22.4 [c.locales]) for data race considerations whensetlocale
is invoked. —end note]
After paragraph 2, add new paragraph.
The function
setlocale
is not required to avoid data races (17.6.5.7), and in particular may race with the following functions.
exec fprintf fscanf isalnum isalpha isblank iscntrl isdigit isgraph islower isprint ispunct isspace isupper iswalnum iswalpha iswblank iswcntrl iswctype iswdigit iswgraph iswlower iswprint iswpunct iswspace iswupper iswxdigit isxdigit localeconv mblen mbstowcs mbtowc nl_langinfo setlocale strcoll strerror strfmon strsignal strtod strxfrm tolower toupper towlower towupper uselocale wcscoll wcstod wcstombs wcsxfrm wctomb
Before "See also", add a new paragraph.
The function
tmpnam
is not required to avoid data races (17.6.5.7) if its argument isNULL
.