1<html lang="en"> 2<head> 3<title>C++98 Thread-Local Edits - Using the GNU Compiler Collection (GCC)</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Using the GNU Compiler Collection (GCC)"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="up" href="Thread_002dLocal.html#Thread_002dLocal" title="Thread-Local"> 9<link rel="prev" href="C99-Thread_002dLocal-Edits.html#C99-Thread_002dLocal-Edits" title="C99 Thread-Local Edits"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<!-- 12Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 131998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 142010 Free Software Foundation, Inc. 15 16Permission is granted to copy, distribute and/or modify this document 17under the terms of the GNU Free Documentation License, Version 1.3 or 18any later version published by the Free Software Foundation; with the 19Invariant Sections being ``Funding Free Software'', the Front-Cover 20Texts being (a) (see below), and with the Back-Cover Texts being (b) 21(see below). A copy of the license is included in the section entitled 22``GNU Free Documentation License''. 23 24(a) The FSF's Front-Cover Text is: 25 26 A GNU Manual 27 28(b) The FSF's Back-Cover Text is: 29 30 You have freedom to copy and modify this GNU Manual, like GNU 31 software. Copies published by the Free Software Foundation raise 32 funds for GNU development.--> 33<meta http-equiv="Content-Style-Type" content="text/css"> 34<style type="text/css"><!-- 35 pre.display { font-family:inherit } 36 pre.format { font-family:inherit } 37 pre.smalldisplay { font-family:inherit; font-size:smaller } 38 pre.smallformat { font-family:inherit; font-size:smaller } 39 pre.smallexample { font-size:smaller } 40 pre.smalllisp { font-size:smaller } 41 span.sc { font-variant:small-caps } 42 span.roman { font-family:serif; font-weight:normal; } 43 span.sansserif { font-family:sans-serif; font-weight:normal; } 44--></style> 45<link rel="stylesheet" type="text/css" href="../cs.css"> 46</head> 47<body> 48<div class="node"> 49<a name="C++98-Thread-Local-Edits"></a> 50<a name="C_002b_002b98-Thread_002dLocal-Edits"></a> 51<p> 52Previous: <a rel="previous" accesskey="p" href="C99-Thread_002dLocal-Edits.html#C99-Thread_002dLocal-Edits">C99 Thread-Local Edits</a>, 53Up: <a rel="up" accesskey="u" href="Thread_002dLocal.html#Thread_002dLocal">Thread-Local</a> 54<hr> 55</div> 56 57<h4 class="subsection">6.58.2 ISO/IEC 14882:1998 Edits for Thread-Local Storage</h4> 58 59<p>The following are a set of changes to ISO/IEC 14882:1998 (aka C++98) 60that document the exact semantics of the language extension. 61 62 <ul> 63<li><b>[intro.execution]</b> 64 65 <p>New text after paragraph 4 66 67 <blockquote> 68A <dfn>thread</dfn> is a flow of control within the abstract machine. 69It is implementation defined whether or not there may be more than 70one thread. 71</blockquote> 72 73 <p>New text after paragraph 7 74 75 <blockquote> 76It is unspecified whether additional action must be taken to 77ensure when and whether side effects are visible to other threads. 78</blockquote> 79 80 <li><b>[lex.key]</b> 81 82 <p>Add <code>__thread</code>. 83 84 <li><b>[basic.start.main]</b> 85 86 <p>Add after paragraph 5 87 88 <blockquote> 89The thread that begins execution at the <code>main</code> function is called 90the <dfn>main thread</dfn>. It is implementation defined how functions 91beginning threads other than the main thread are designated or typed. 92A function so designated, as well as the <code>main</code> function, is called 93a <dfn>thread startup function</dfn>. It is implementation defined what 94happens if a thread startup function returns. It is implementation 95defined what happens to other threads when any thread calls <code>exit</code>. 96</blockquote> 97 98 <li><b>[basic.start.init]</b> 99 100 <p>Add after paragraph 4 101 102 <blockquote> 103The storage for an object of thread storage duration shall be 104statically initialized before the first statement of the thread startup 105function. An object of thread storage duration shall not require 106dynamic initialization. 107</blockquote> 108 109 <li><b>[basic.start.term]</b> 110 111 <p>Add after paragraph 3 112 113 <blockquote> 114The type of an object with thread storage duration shall not have a 115non-trivial destructor, nor shall it be an array type whose elements 116(directly or indirectly) have non-trivial destructors. 117</blockquote> 118 119 <li><b>[basic.stc]</b> 120 121 <p>Add “thread storage duration” to the list in paragraph 1. 122 123 <p>Change paragraph 2 124 125 <blockquote> 126Thread, static, and automatic storage durations are associated with 127objects introduced by declarations [<small class="dots">...</small>]. 128</blockquote> 129 130 <p>Add <code>__thread</code> to the list of specifiers in paragraph 3. 131 132 <li><b>[basic.stc.thread]</b> 133 134 <p>New section before <b>[basic.stc.static]</b> 135 136 <blockquote> 137The keyword <code>__thread</code> applied to a non-local object gives the 138object thread storage duration. 139 140 <p>A local variable or class data member declared both <code>static</code> 141and <code>__thread</code> gives the variable or member thread storage 142duration. 143</blockquote> 144 145 <li><b>[basic.stc.static]</b> 146 147 <p>Change paragraph 1 148 149 <blockquote> 150All objects which have neither thread storage duration, dynamic 151storage duration nor are local [<small class="dots">...</small>]. 152</blockquote> 153 154 <li><b>[dcl.stc]</b> 155 156 <p>Add <code>__thread</code> to the list in paragraph 1. 157 158 <p>Change paragraph 1 159 160 <blockquote> 161With the exception of <code>__thread</code>, at most one 162<var>storage-class-specifier</var> shall appear in a given 163<var>decl-specifier-seq</var>. The <code>__thread</code> specifier may 164be used alone, or immediately following the <code>extern</code> or 165<code>static</code> specifiers. [<small class="dots">...</small>] 166</blockquote> 167 168 <p>Add after paragraph 5 169 170 <blockquote> 171The <code>__thread</code> specifier can be applied only to the names of objects 172and to anonymous unions. 173</blockquote> 174 175 <li><b>[class.mem]</b> 176 177 <p>Add after paragraph 6 178 179 <blockquote> 180Non-<code>static</code> members shall not be <code>__thread</code>. 181</blockquote> 182 </ul> 183 184 </body></html> 185 186