Imported Upstream version 1.51.0
[platform/upstream/boost.git] / doc / html / thread / build.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Using and building the library</title>
5 <link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
8 <link rel="up" href="../thread.html" title="Chapter&#160;28.&#160;Thread 3.0.1">
9 <link rel="prev" href="../thread.html" title="Chapter&#160;28.&#160;Thread 3.0.1">
10 <link rel="next" href="changes.html" title="History">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
15 <td align="center"><a href="../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="../thread.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../thread.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="changes.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h2 class="title" style="clear: both">
27 <a name="thread.build"></a><a class="link" href="build.html" title="Using and building the library">Using and building the library</a>
28 </h2></div></div></div>
29 <div class="toc"><dl>
30 <dt><span class="section"><a href="build.html#thread.build.configuration">Configuration</a></span></dt>
31 <dt><span class="section"><a href="build.html#thread.build.limitations">Limitations</a></span></dt>
32 </dl></div>
33 <p>
34       Boost.Thread is configured following the conventions used to build <a href="http://www.boost.org/doc/libs/1_48_0/libs/config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_for_libraries_with_separate_source_code" target="_top">libraries
35       with separate source code</a>. Boost.Thread will import/export the code
36       only if the user has specifically asked for it, by defining either BOOST_ALL_DYN_LINK
37       if they want all boost libraries to be dynamically linked, or BOOST_THREAD_DYN_LINK
38       if they want just this one to be dynamically liked.
39     </p>
40 <p>
41       The definition of these macros determines whether BOOST_THREAD_USE_DLL is defined.
42       If BOOST_THREAD_USE_DLL is not defined, the library will define BOOST_THREAD_USE_DLL
43       or BOOST_THREAD_USE_LIB depending on whether the platform. On non windows platforms
44       BOOST_THREAD_USE_LIB is defined if is not defined. In windows platforms, BOOST_THREAD_USE_LIB
45       is defined if BOOST_THREAD_USE_DLL and the compiler supports auto-tss cleanup
46       with Boost.Threads (for the time been Msvc and Intel)
47     </p>
48 <p>
49       The source code compiled when building the library defines a macros BOOST_THREAD_SOURCE
50       that is used to import or export it. The user must not define this macro in
51       any case.
52     </p>
53 <p>
54       The following section describes all the macros used to configure Boost.Thread.
55     </p>
56 <div class="section">
57 <div class="titlepage"><div><div><h3 class="title">
58 <a name="thread.build.configuration"></a><a class="link" href="build.html#thread.build.configuration" title="Configuration">Configuration</a>
59 </h3></div></div></div>
60 <div class="toc"><dl>
61 <dt><span class="section"><a href="build.html#thread.build.configuration.system">Boost.System</a></span></dt>
62 <dt><span class="section"><a href="build.html#thread.build.configuration.chrono">Boost.Chrono</a></span></dt>
63 <dt><span class="section"><a href="build.html#thread.build.configuration.move">Boost.Move</a></span></dt>
64 <dt><span class="section"><a href="build.html#thread.build.configuration.shared_gen">Shared Locking
65         Generic</a></span></dt>
66 <dt><span class="section"><a href="build.html#thread.build.configuration.shared_upwards">Shared Locking
67         Upwards Conversion</a></span></dt>
68 <dt><span class="section"><a href="build.html#thread.build.configuration.explicit_cnv">Explicit Lock
69         Conversion</a></span></dt>
70 <dt><span class="section"><a href="build.html#thread.build.configuration.future">unique_future versus
71         future</a></span></dt>
72 <dt><span class="section"><a href="build.html#thread.build.configuration.lazy">promise lazy initialization</a></span></dt>
73 <dt><span class="section"><a href="build.html#thread.build.configuration.alloc">promise Allocator
74         constructor</a></span></dt>
75 <dt><span class="section"><a href="build.html#thread.build.configuration.terminate">Call to terminate
76         if joinable</a></span></dt>
77 <dt><span class="section"><a href="build.html#thread.build.configuration.once_flag">once_flag</a></span></dt>
78 <dt><span class="section"><a href="build.html#thread.build.configuration.deprecated">Deprecated</a></span></dt>
79 <dt><span class="section"><a href="build.html#thread.build.configuration.version">Version</a></span></dt>
80 </dl></div>
81 <div class="section">
82 <div class="titlepage"><div><div><h4 class="title">
83 <a name="thread.build.configuration.system"></a><a class="link" href="build.html#thread.build.configuration.system" title="Boost.System">Boost.System</a>
84 </h4></div></div></div>
85 <p>
86           Boost.Thread uses by default Boost.System to define the exceptions. For
87           backward compatibility and also for compilers that don't work well with
88           Boost.System the user can define <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_USE_SYSTEM</span>
89           </code>.
90         </p>
91 <p>
92           <code class="computeroutput"><span class="identifier">BOOST_THREAD_USES_SYSTEM</span></code>
93           is defined when Boost.Thread uses Boost.Move.
94         </p>
95 </div>
96 <div class="section">
97 <div class="titlepage"><div><div><h4 class="title">
98 <a name="thread.build.configuration.chrono"></a><a class="link" href="build.html#thread.build.configuration.chrono" title="Boost.Chrono">Boost.Chrono</a>
99 </h4></div></div></div>
100 <p>
101           Boost.Thread uses by default Boost.Chrono for the time related functions.
102           For backward compatibility and also for compilers that don't work well
103           with Boost.Chrono the user can define <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_USE_CHRONO</span></code>.
104           If <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_USE_SYSTEM</span></code>
105           is defined then <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_USE_CHRONO</span></code>
106           is defined implicitly.
107         </p>
108 <p>
109           <code class="computeroutput"><span class="identifier">BOOST_THREAD_USES_CHRONO</span></code>
110           is defined when Boost.Thread uses Boost.Chrono.
111         </p>
112 </div>
113 <div class="section">
114 <div class="titlepage"><div><div><h4 class="title">
115 <a name="thread.build.configuration.move"></a><a class="link" href="build.html#thread.build.configuration.move" title="Boost.Move">Boost.Move</a>
116 </h4></div></div></div>
117 <p>
118           Boost.Thread uses by default an internal move semantic implementation.
119           Since version 3.0.0 you can use the move emulation emulation provided by
120           Boost.Move.
121         </p>
122 <p>
123           When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
124           <code class="computeroutput"><span class="identifier">BOOST_THREAD_USES_MOVE</span> </code>
125           if you want to use Boost.Move interface. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">3</span></code> define
126           <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_USE_MOVE</span> </code>
127           if you want to use boost::unique_future.
128         </p>
129 </div>
130 <div class="section">
131 <div class="titlepage"><div><div><h4 class="title">
132 <a name="thread.build.configuration.shared_gen"></a><a class="link" href="build.html#thread.build.configuration.shared_gen" title="Shared Locking Generic">Shared Locking
133         Generic</a>
134 </h4></div></div></div>
135 <p>
136           The shared mutex implementation on Windows platform provides currently
137           less functionality than the generic one that is used for PTheads based
138           platforms. In order to have access to these functions, the user needs to
139           define <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN</span></code>
140           to use the generic implementation, that while could be less efficient,
141           provides all the functions.
142         </p>
143 <p>
144           When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
145           <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN</span>
146           </code> if you want these features. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">3</span></code> define
147           <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_GENERIC_SHARED_MUTEX_ON_WIN</span>
148           </code> if you don't want these features.
149         </p>
150 </div>
151 <div class="section">
152 <div class="titlepage"><div><div><h4 class="title">
153 <a name="thread.build.configuration.shared_upwards"></a><a class="link" href="build.html#thread.build.configuration.shared_upwards" title="Shared Locking Upwards Conversion">Shared Locking
154         Upwards Conversion</a>
155 </h4></div></div></div>
156 <p>
157           Boost.Threads includes in version 2 the Shared Locking Upwards Conversion
158           as defined in <a href="http://home.roadrunner.com/~hinnant/bloomington/shared_mutex.html" target="_top">Shared
159           Locking</a>. These conversions need to be used carefully to avoid deadlock
160           or livelock. The user need to define explicitly <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSION</span></code>
161           to get these upwards conversions.
162         </p>
163 <p>
164           When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
165           <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSION</span>
166           </code> if you want these features. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">3</span></code> define
167           <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_SHARED_MUTEX_UPWARDS_CONVERSION</span>
168           </code> if you don't want these features.
169         </p>
170 </div>
171 <div class="section">
172 <div class="titlepage"><div><div><h4 class="title">
173 <a name="thread.build.configuration.explicit_cnv"></a><a class="link" href="build.html#thread.build.configuration.explicit_cnv" title="Explicit Lock Conversion">Explicit Lock
174         Conversion</a>
175 </h4></div></div></div>
176 <p>
177           In <a href="http://home.roadrunner.com/~hinnant/bloomington/shared_mutex.html" target="_top">Shared
178           Locking</a> the lock conversions are explicit. As this explicit conversion
179           breaks the lock interfaces, it is provided only if the <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION</span></code>
180           is defined.
181         </p>
182 <p>
183           When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
184           <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION</span>
185           </code> if you want these features. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">3</span></code> define
186           <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_EXPLICIT_LOCK_CONVERSION</span>
187           </code> if you don't want these features.
188         </p>
189 </div>
190 <div class="section">
191 <div class="titlepage"><div><div><h4 class="title">
192 <a name="thread.build.configuration.future"></a><a class="link" href="build.html#thread.build.configuration.future" title="unique_future versus future">unique_future versus
193         future</a>
194 </h4></div></div></div>
195 <p>
196           C++11 uses <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">future</span></code>. Versions of Boost.Thread previous
197           to version 3.0.0 uses <code class="computeroutput"><span class="identifier">boost</span><span class="special">:</span><span class="identifier">unique_future</span></code>.
198           Since version 3.0.0 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">future</span></code>
199           replaces <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unique_future</span></code> when <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_FUTURE</span></code>
200           is defined. The documentation doesn't contains anymore however <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unique_future</span></code>.
201         </p>
202 <p>
203           When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
204           <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_FUTURE</span></code>
205           if you want to use boost::future. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">3</span></code> define
206           <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_FUTURE</span></code>
207           if you want to use boost::unique_future.
208         </p>
209 </div>
210 <div class="section">
211 <div class="titlepage"><div><div><h4 class="title">
212 <a name="thread.build.configuration.lazy"></a><a class="link" href="build.html#thread.build.configuration.lazy" title="promise lazy initialization">promise lazy initialization</a>
213 </h4></div></div></div>
214 <p>
215           C++11 promise initialize the associated state at construction time. Versions
216           of Boost.Thread previous to version 3.0.0 initialize it lazily at any point
217           in time in which this associated state is needed.
218         </p>
219 <p>
220           Since version 3.0.0 this difference in behavior can be configured. When
221           <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_PROMISE_LAZY</span></code>
222           is defined the backward compatible behavior is provided.
223         </p>
224 <p>
225           When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
226           <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_PROMISE_LAZY</span>
227           </code> if you want to use boost::future. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">3</span></code> define
228           <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_PROMISE_LAZY</span>
229           </code> if you want to use boost::unique_future.
230         </p>
231 </div>
232 <div class="section">
233 <div class="titlepage"><div><div><h4 class="title">
234 <a name="thread.build.configuration.alloc"></a><a class="link" href="build.html#thread.build.configuration.alloc" title="promise Allocator constructor">promise Allocator
235         constructor</a>
236 </h4></div></div></div>
237 <p>
238           C++11 std::promise provides constructors with allocators.
239         </p>
240 <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">R</span><span class="special">&gt;</span>
241 <span class="keyword">class</span> <span class="identifier">promise</span>
242 <span class="special">{</span>
243   <span class="keyword">public</span><span class="special">:</span>
244     <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">&gt;</span>
245     <span class="keyword">explicit</span> <span class="identifier">promise</span><span class="special">(</span><span class="identifier">allocator_arg_t</span><span class="special">,</span> <span class="identifier">Allocator</span> <span class="identifier">a</span><span class="special">);</span>
246   <span class="comment">// ...</span>
247 <span class="special">};</span>
248 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">uses_allocator</span><span class="special">&lt;</span><span class="identifier">promise</span><span class="special">&lt;</span><span class="identifier">R</span><span class="special">&gt;,</span><span class="identifier">Alloc</span><span class="special">&gt;:</span> <span class="identifier">true_type</span> <span class="special">{};</span>
249 </pre>
250 <p>
251           where
252         </p>
253 <pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">allocator_arg_t</span> <span class="special">{</span> <span class="special">};</span>
254 <span class="identifier">constexpr</span> <span class="identifier">allocator_arg_t</span> <span class="identifier">allocator_arg</span> <span class="special">=</span> <span class="identifier">allocator_arg_t</span><span class="special">();</span>
255
256 <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="keyword">struct</span> <span class="identifier">uses_allocator</span><span class="special">;</span>
257 </pre>
258 <p>
259           Since version 3.0.0 Boost.Thread implements this constructor using the
260           following interface
261         </p>
262 <pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
263 <span class="special">{</span>
264   <span class="keyword">typedef</span> <span class="identifier">container</span><span class="special">::</span><span class="identifier">allocator_arg_t</span> <span class="identifier">allocator_arg_t</span><span class="special">;</span>
265   <span class="identifier">constexpr</span> <span class="identifier">allocator_arg_t</span> <span class="identifier">allocator_arg</span> <span class="special">=</span> <span class="special">{};</span>
266
267   <span class="keyword">namespace</span> <span class="identifier">container</span>
268   <span class="special">{</span>
269     <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">R</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
270     <span class="keyword">struct</span> <span class="identifier">uses_allocator</span><span class="special">&lt;</span><span class="identifier">promise</span><span class="special">&lt;</span><span class="identifier">R</span><span class="special">&gt;,</span><span class="identifier">Alloc</span><span class="special">&gt;:</span> <span class="identifier">true_type</span> <span class="special">{};</span>
271   <span class="special">}</span>
272   <span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Alloc</span><span class="special">&gt;</span>
273   <span class="keyword">struct</span> <span class="identifier">uses_allocator</span> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">container</span><span class="special">::</span><span class="identifier">uses_allocator</span><span class="special">&lt;</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">&gt;</span> <span class="special">{};</span>
274 <span class="special">}</span>
275 </pre>
276 <p>
277           which introduces a dependency on Boost.Container. This feature is provided
278           only if <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS</span></code>
279           is defined.
280         </p>
281 <p>
282           When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
283           <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS</span>
284           </code> if you want these features. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">3</span></code> define
285           <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS</span>
286           </code> if you don't want these features.
287         </p>
288 </div>
289 <div class="section">
290 <div class="titlepage"><div><div><h4 class="title">
291 <a name="thread.build.configuration.terminate"></a><a class="link" href="build.html#thread.build.configuration.terminate" title="Call to terminate if joinable">Call to terminate
292         if joinable</a>
293 </h4></div></div></div>
294 <p>
295           C++11 has a different semantic for the thread destructor and the move assignment.
296           Instead of detaching the thread, calls to terminate() if the thread was
297           joinable. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE</span></code>
298           and <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE</span></code>
299           is defined Boost.Thread provides the C++ semantic.
300         </p>
301 <p>
302           When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
303           <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE</span>
304           </code> if you want these features. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">3</span></code> define
305           <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE</span>
306           </code> if you don't want these features.
307         </p>
308 <p>
309           When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
310           <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE</span>
311           </code> if you want these features. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">3</span></code> define
312           <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE</span>
313           </code> if you don't want these features.
314         </p>
315 </div>
316 <div class="section">
317 <div class="titlepage"><div><div><h4 class="title">
318 <a name="thread.build.configuration.once_flag"></a><a class="link" href="build.html#thread.build.configuration.once_flag" title="once_flag">once_flag</a>
319 </h4></div></div></div>
320 <p>
321           C++11 defines a default constructor for once_flag. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_ONCE_CXX11</span>
322           </code> is defined Boost.Thread provides this C++ semantics. In this case,
323           the previous aggregate syntax is not supported.
324         </p>
325 <pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">once_flag</span> <span class="identifier">once</span> <span class="special">=</span> <span class="identifier">BOOST_ONCE_INIT</span><span class="special">;</span>
326 </pre>
327 <p>
328           You should now just do
329         </p>
330 <pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">once_flag</span> <span class="identifier">once</span><span class="special">;</span>
331 </pre>
332 <p>
333           When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
334           <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_ONCE_CXX11</span></code>
335           if you want these features. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">3</span></code> define
336           <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_ONCE_CXX11</span></code>
337           if you don't want these features.
338         </p>
339 </div>
340 <div class="section">
341 <div class="titlepage"><div><div><h4 class="title">
342 <a name="thread.build.configuration.deprecated"></a><a class="link" href="build.html#thread.build.configuration.deprecated" title="Deprecated">Deprecated</a>
343 </h4></div></div></div>
344 <p>
345           Version 3.0.0 deprecates some Boost.Thread features.
346         </p>
347 <p>
348           These deprecated features will be provided by default up to boost 1.52.
349           If you don't want to include the deprecated features you could define
350           <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0</span></code>.
351           Since 1.53 these features will not be included any more by default. Since
352           this version, if you want to include the deprecated features yet you could
353           define <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0</span></code>.
354           These deprecated features will be only available until boost 1.55, that
355           is you have 1 year and a half to move to the new features.
356         </p>
357 </div>
358 <div class="section">
359 <div class="titlepage"><div><div><h4 class="title">
360 <a name="thread.build.configuration.version"></a><a class="link" href="build.html#thread.build.configuration.version" title="Version">Version</a>
361 </h4></div></div></div>
362 <p>
363           <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span></code> defines
364           the Boost.Thread version. The default version is 2. In this case the following
365           breaking or extending macros are defined if the opposite is not requested:
366         </p>
367 <div class="itemizedlist"><ul class="itemizedlist" type="disc">
368 <li class="listitem">
369               <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_PROMISE_LAZY</span></code>
370             </li>
371 <li class="listitem">
372               <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0</span></code>
373             </li>
374 </ul></div>
375 <p>
376           The user can request the version 3 by defining <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span></code>
377           to 3. In this case the following breaking or extending macros are defined
378           if the opposite is not requested:
379         </p>
380 <div class="itemizedlist"><ul class="itemizedlist" type="disc">
381 <li class="listitem">
382               Breaking change <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION</span>
383               </code>
384             </li>
385 <li class="listitem">
386               Breaking change <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_FUTURE</span></code>
387             </li>
388 <li class="listitem">
389               Uniformity <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN</span></code>
390             </li>
391 <li class="listitem">
392               Extension <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSION</span></code>
393             </li>
394 <li class="listitem">
395               Conformity <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS</span></code>
396             </li>
397 <li class="listitem">
398               Breaking change BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE
399             </li>
400 <li class="listitem">
401               Breaking change BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE
402             </li>
403 <li class="listitem">
404               Breaking change <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_ONCE_CXX11</span></code>
405             </li>
406 <li class="listitem">
407               Breaking change <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_PROMISE_LAZY</span></code>
408             </li>
409 <li class="listitem">
410               Breaking change <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0</span></code>
411             </li>
412 </ul></div>
413 <p>
414           The default value for <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span></code>
415           will be changed to 3 since Boost 1.53.
416         </p>
417 </div>
418 </div>
419 <div class="section">
420 <div class="titlepage"><div><div><h3 class="title">
421 <a name="thread.build.limitations"></a><a class="link" href="build.html#thread.build.limitations" title="Limitations">Limitations</a>
422 </h3></div></div></div>
423 <div class="toc"><dl>
424 <dt><span class="section"><a href="build.html#thread.build.limitations.sun">SunPro</a></span></dt>
425 <dt><span class="section"><a href="build.html#thread.build.limitations.vacpp">VACPP</a></span></dt>
426 </dl></div>
427 <p>
428         Some compilers don't work correctly with some of the added features.
429       </p>
430 <div class="section">
431 <div class="titlepage"><div><div><h4 class="title">
432 <a name="thread.build.limitations.sun"></a><a class="link" href="build.html#thread.build.limitations.sun" title="SunPro">SunPro</a>
433 </h4></div></div></div>
434 <p>
435           If __SUNPRO_CC &lt; 0x5100 the library defines
436         </p>
437 <div class="itemizedlist"><ul class="itemizedlist" type="disc">
438 <li class="listitem">
439               <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_USE_MOVE</span></code>
440             </li>
441 <li class="listitem">
442               <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS</span></code>
443             </li>
444 </ul></div>
445 </div>
446 <div class="section">
447 <div class="titlepage"><div><div><h4 class="title">
448 <a name="thread.build.limitations.vacpp"></a><a class="link" href="build.html#thread.build.limitations.vacpp" title="VACPP">VACPP</a>
449 </h4></div></div></div>
450 <p>
451           If __IBMCPP__ is defined the library defines
452         </p>
453 <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
454               <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_USE_CHRONO</span></code>
455             </li></ul></div>
456 <p>
457           And Boost.Thread doesn't links with Boost.Chrono.
458         </p>
459 </div>
460 </div>
461 </div>
462 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
463 <td align="left"></td>
464 <td align="right"><div class="copyright-footer">Copyright &#169; 2007 -11 Anthony Williams<br>Copyright &#169; 2011 -12 Vicente J. Botet Escriba<p>
465         Distributed under the Boost Software License, Version 1.0. (See accompanying
466         file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
467       </p>
468 </div></td>
469 </tr></table>
470 <hr>
471 <div class="spirit-nav">
472 <a accesskey="p" href="../thread.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../thread.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="changes.html"><img src="../../../doc/src/images/next.png" alt="Next"></a>
473 </div>
474 </body>
475 </html>