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