This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

1144. "thread safe" is undefined

Section: 17.5 [support.start.term] Status: C++11 Submitter: LWG Opened: 2009-06-16 Last modified: 2016-01-28

Priority: Not Prioritized

View other active issues in [support.start.term].

View all other issues in [support.start.term].

View all issues with C++11 status.

Discussion:

Addresses UK 187

The term "thread safe" is not defined nor used in this context anywhere else in the standard.

Suggested action:

Clarify the meaning of "thread safe".

[ 2009 Santa Cruz: ]

The "thread safe" language has already been change in the WP. It was changed to "happen before", but the current WP text is still a little incomplete: "happen before" is binary, but the current WP text only mentions one thing.

Move to Ready.

Proposed resolution:

For the following functions in 17.5 [support.start.term].


extern "C" int at_quick_exit(void (*f)(void));
extern "C++" int at_quick_exit(void (*f)(void));

Edit paragraph 10 as follows. The intent is to provide the other half of the happens before relation; to note indeterminate ordering; and to clean up some formatting.

Effects: The at_quick_exit() functions register the function pointed to by f to be called without arguments when quick_exit is called. It is unspecified whether a call to at_quick_exit() that does not happen-before happen before (1.10) all calls to quick_exit will succeed. [Note: the at_quick_exit() functions shall not introduce a data race (17.6.4.7). exitnote end note] [Note: The order of registration may be indeterminate if at_quick_exit was called from more than one thread. —end note] [Note: The at_quick_exit registrations are distinct from the atexit registrations, and applications may need to call both registration functions with the same argument. —end note]

For the following function.


void quick_exit [[noreturn]] (int status)

Edit paragraph 13 as follows. The intent is to note that thread-local variables may be different.

Effects: Functions registered by calls to at_quick_exit are called in the reverse order of their registration, except that a function shall be called after any previously registered functions that had already been called at the time it was registered. Objects shall not be destroyed as a result of calling quick_exit. If control leaves a registered function called by quick_exit because the function does not provide a handler for a thrown exception, terminate() shall be called. [Note: Functions registered by one thread may be called by any thread, and hence should not rely on the identity of thread-storage-duration objects. —end note] After calling registered functions, quick_exit shall call _Exit(status). [Note: The standard file buffers are not flushed. See: ISO C 7.20.4.4. —end note]