The following are a set of changes to ISO/IEC 14882:1998 (aka C++98) that document the exact semantics of the language extension.
New text after paragraph 4
A thread is a flow of control within the abstract machine. It is implementation defined whether or not there may be more than one thread.
New text after paragraph 7
It is unspecified whether additional action must be taken to ensure when and whether side effects are visible to other threads.
Add __thread
.
Add after paragraph 5
The thread that begins execution at the
main
function is called the main thread. It is implementation defined how functions beginning threads other than the main thread are designated or typed. A function so designated, as well as themain
function, is called a thread startup function. It is implementation defined what happens if a thread startup function returns. It is implementation defined what happens to other threads when any thread callsexit
.
Add after paragraph 4
The storage for an object of thread storage duration shall be statically initialized before the first statement of the thread startup function. An object of thread storage duration shall not require dynamic initialization.
Add after paragraph 3
The type of an object with thread storage duration shall not have a non-trivial destructor, nor shall it be an array type whose elements (directly or indirectly) have non-trivial destructors.
Add “thread storage duration” to the list in paragraph 1.
Change paragraph 2
Thread, static, and automatic storage durations are associated with objects introduced by declarations […].
Add __thread
to the list of specifiers in paragraph 3.
New section before [basic.stc.static]
The keyword
__thread
applied to a non-local object gives the object thread storage duration.A local variable or class data member declared both
static
and__thread
gives the variable or member thread storage duration.
Change paragraph 1
All objects that have neither thread storage duration, dynamic storage duration nor are local […].
Add __thread
to the list in paragraph 1.
Change paragraph 1
With the exception of
__thread
, at most one storage-class-specifier shall appear in a given decl-specifier-seq. The__thread
specifier may be used alone, or immediately following theextern
orstatic
specifiers. […]
Add after paragraph 5
The
__thread
specifier can be applied only to the names of objects and to anonymous unions.
Add after paragraph 6
Non-
static
members shall not be__thread
.