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.78.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 30. Thread 4.4.0">
9 <link rel="prev" href="../thread.html" title="Chapter 30. Thread 4.4.0">
10 <link rel="next" href="changes.html" title="History">
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>
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>
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 class="toc">
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>
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.
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)
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
54 Boost.Thread depends on some non header-only libraries.
56 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
58 Boost.System: This dependency is mandatory and you will need to link with
62 Boost.Chrono: This dependency is optional (see below how to configure)
63 and you will need to link with the library if you use some of the time
67 Boost.DateTime: This dependency is mandatory, but even if Boost.DateTime
68 is a non header-only library Boost.Thread uses only parts that are header-only,
69 so in principle you should not need to link with the library.
73 It seems that there are some IDE (as e.g. Visual Studio) that deduce the libraries
74 that a program needs to link to inspecting the sources. Such IDE could force
75 to link to Boost.DateTime and/or Boost.Chrono.
78 As the single mandatory dependency is to Boost.System, the following
80 <pre class="programlisting"><span class="identifier">bjam</span> <span class="identifier">toolset</span><span class="special">=</span><span class="identifier">msvc</span><span class="special">-</span><span class="number">11.0</span> <span class="special">--</span><span class="identifier">build</span><span class="special">-</span><span class="identifier">type</span><span class="special">=</span><span class="identifier">complete</span> <span class="special">--</span><span class="identifier">with</span><span class="special">-</span><span class="identifier">thread</span>
83 will install only boost_thread and boost_system.
86 Users of such IDE should force the Boost.Chrono and Boost.DateTime build using
88 <pre class="programlisting"><span class="identifier">bjam</span> <span class="identifier">toolset</span><span class="special">=</span><span class="identifier">msvc</span><span class="special">-</span><span class="number">11.0</span> <span class="special">--</span><span class="identifier">build</span><span class="special">-</span><span class="identifier">type</span><span class="special">=</span><span class="identifier">complete</span> <span class="special">--</span><span class="identifier">with</span><span class="special">-</span><span class="identifier">thread</span> <span class="special">--</span><span class="identifier">with</span><span class="special">-</span><span class="identifier">chrono</span> <span class="special">--</span><span class="identifier">with</span><span class="special">-</span><span class="identifier">date_time</span>
91 The following section describes all the macros used to configure Boost.Thread.
94 <div class="titlepage"><div><div><h3 class="title">
95 <a name="thread.build.configuration"></a><a class="link" href="build.html#thread.build.configuration" title="Configuration">Configuration</a>
96 </h3></div></div></div>
97 <div class="toc"><dl class="toc">
98 <dt><span class="section"><a href="build.html#thread.build.configuration.chrono">Boost.Chrono</a></span></dt>
99 <dt><span class="section"><a href="build.html#thread.build.configuration.move">Boost.Move</a></span></dt>
100 <dt><span class="section"><a href="build.html#thread.build.configuration.date_time">Boost.DateTime</a></span></dt>
101 <dt><span class="section"><a href="build.html#thread.build.configuration.move0">Boost.Atomic</a></span></dt>
102 <dt><span class="section"><a href="build.html#thread.build.configuration.thread_eq"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">thread</span><span class="special">::</span><span class="keyword">operator</span><span class="special">==</span></code>
103 deprecated</a></span></dt>
104 <dt><span class="section"><a href="build.html#thread.build.configuration.condition">boost::condition
105 deprecated</a></span></dt>
106 <dt><span class="section"><a href="build.html#thread.build.configuration.nested_lock">Mutex nested
107 lock types deprecated</a></span></dt>
108 <dt><span class="section"><a href="build.html#thread.build.configuration.id">thread::id</a></span></dt>
109 <dt><span class="section"><a href="build.html#thread.build.configuration.shared_gen">Shared Locking
110 Generic</a></span></dt>
111 <dt><span class="section"><a href="build.html#thread.build.configuration.shared_upwards">Shared Locking
112 Upwards Conversion</a></span></dt>
113 <dt><span class="section"><a href="build.html#thread.build.configuration.explicit_cnv">Explicit Lock
114 Conversion</a></span></dt>
115 <dt><span class="section"><a href="build.html#thread.build.configuration.future">unique_future versus
116 future</a></span></dt>
117 <dt><span class="section"><a href="build.html#thread.build.configuration.lazy">promise lazy initialization</a></span></dt>
118 <dt><span class="section"><a href="build.html#thread.build.configuration.alloc">promise Allocator
119 constructor</a></span></dt>
120 <dt><span class="section"><a href="build.html#thread.build.configuration.terminate">Call to terminate
121 if joinable</a></span></dt>
122 <dt><span class="section"><a href="build.html#thread.build.configuration.once_flag">once_flag</a></span></dt>
123 <dt><span class="section"><a href="build.html#thread.build.configuration.deprecated">Signature parameter
124 for packaged_task</a></span></dt>
125 <dt><span class="section"><a href="build.html#thread.build.configuration.thread_const">-var thread
126 constructor with variadic rvalue parameters</a></span></dt>
127 <dt><span class="section"><a href="build.html#thread.build.configuration.get_invalid">future<>::get()
128 invalidates the future</a></span></dt>
129 <dt><span class="section"><a href="build.html#thread.build.configuration.intr">Interruptions</a></span></dt>
130 <dt><span class="section"><a href="build.html#thread.build.configuration.version">Version</a></span></dt>
133 <a name="thread.build.configuration.default_values_for_configurable_features"></a><p class="title"><b>Table 30.1. Default Values for Configurable Features</b></p>
134 <div class="table-contents"><table class="table" summary="Default Values for Configurable Features">
200 PROVIDES_INTERRUPTIONS
205 DONT_PROVIDE_INTERRUPTIONS
227 THROW_IF_PRECONDITION_NOT_SATISFIED
254 PROVIDES_PROMISE_LAZY
259 DONT_PROVIDE_PROMISE_LAZY
281 PROVIDES_BASIC_THREAD_ID
286 DONT_PROVIDE_BASIC_THREAD_ID
308 PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN
313 DONT_PROVIDE_GENERIC_SHARED_MUTEX_ON_WIN
335 PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSION
340 DONT_PROVIDE_SHARED_MUTEX_UPWARDS_CONVERSION
362 PROVIDES_EXPLICIT_LOCK_CONVERSION
367 DONT_PROVIDE_EXPLICIT_LOCK_CONVERSION
416 PROVIDES_FUTURE_CTOR_ALLOCATORS
421 DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS
443 PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE
448 DONT_PROVIDE_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE
470 PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE
475 DONT_PROVIDE_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE
502 DONT_PROVIDE_ONCE_CXX11
583 DONT_PROVIDE_THREAD_EQ
610 DONT_PROVIDE_CONDITION
632 PROVIDES_NESTED_LOCKS
637 DONT_PROVIDE_NESTED_LOCKS
659 PROVIDES_SIGNATURE_PACKAGED_TASK
664 DONT_PROVIDE_SIGNATURE_PACKAGED_TASK
686 PROVIDES_FUTURE_INVALID_AFTER_GET
691 DONT_PROVIDE_FUTURE_INVALID_AFTER_GET
713 PROVIDES_VARIADIC_THREAD
718 DONT_PROVIDE_VARIADIC_THREAD
740 <br class="table-break"><div class="section">
741 <div class="titlepage"><div><div><h4 class="title">
742 <a name="thread.build.configuration.chrono"></a><a class="link" href="build.html#thread.build.configuration.chrono" title="Boost.Chrono">Boost.Chrono</a>
743 </h4></div></div></div>
745 Boost.Thread uses by default Boost.Chrono for the time related functions
746 and define <code class="computeroutput"><span class="identifier">BOOST_THREAD_USES_CHRONO</span></code>
747 if <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_USE_CHRONO</span></code>
748 is not defined. The user should define <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_USE_CHRONO</span></code>
749 for compilers that don't work well with Boost.Chrono.
751 <div class="warning"><table border="0" summary="Warning">
753 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../doc/src/images/warning.png"></td>
754 <th align="left">Warning</th>
756 <tr><td align="left" valign="top"><p>
757 When defined BOOST_THREAD_PLATFORM_WIN32 BOOST_THREAD_USES_CHRONO is
758 defined independently of user settings.
762 <div class="section">
763 <div class="titlepage"><div><div><h4 class="title">
764 <a name="thread.build.configuration.move"></a><a class="link" href="build.html#thread.build.configuration.move" title="Boost.Move">Boost.Move</a>
765 </h4></div></div></div>
767 Boost.Thread uses by default an internal move semantic implementation.
768 Since version 3.0.0 you can use the move emulation emulation provided by
772 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
773 <code class="computeroutput"><span class="identifier">BOOST_THREAD_USES_MOVE</span> </code>
774 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
775 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_USE_MOVE</span> </code>
776 if you don't want to use Boost.Move interface.
779 <div class="section">
780 <div class="titlepage"><div><div><h4 class="title">
781 <a name="thread.build.configuration.date_time"></a><a class="link" href="build.html#thread.build.configuration.date_time" title="Boost.DateTime">Boost.DateTime</a>
782 </h4></div></div></div>
784 The Boost.DateTime time related functions introduced in Boost 1.35.0, using
785 the <a class="link" href="../date_time.html" title="Chapter 9. Boost.Date_Time">Boost.Date_Time</a> library are deprecated.
786 These include (but are not limited to):
788 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
789 <li class="listitem">
790 <a class="link" href="thread_management.html#thread.thread_management.this_thread.sleep" title="Non-member function sleep() DEPRECATED"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">this_thread</span><span class="special">::</span><span class="identifier">sleep</span><span class="special">()</span></code></a>
792 <li class="listitem">
793 <a class="link" href="thread_management.html#thread.thread_management.thread.timed_join" title="Member function timed_join() DEPRECATED"><code class="computeroutput"><span class="identifier">timed_join</span><span class="special">()</span></code></a>
795 <li class="listitem">
796 <a class="link" href="synchronization.html#thread.synchronization.condvar_ref.condition_variable.timed_wait" title="bool timed_wait(boost::unique_lock<boost::mutex>& lock,boost::system_time const& abs_time)"><code class="computeroutput"><span class="identifier">timed_wait</span><span class="special">()</span></code></a>
798 <li class="listitem">
799 <a class="link" href="synchronization.html#thread.synchronization.mutex_concepts.timed_lockable.timed_lock" title="m.timed_lock(abs_time)"><code class="computeroutput"><span class="identifier">timed_lock</span><span class="special">()</span></code></a>
803 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special"><=</span><span class="number">3</span></code> &&
804 defined BOOST_THREAD_PLATFORM_PTHREAD define <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_USE_DATETIME</span></code>
805 if you don't want to use Boost.DateTime related interfaces. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">></span><span class="number">3</span></code> && defined BOOST_THREAD_PLATFORM_PTHREAD
806 define <code class="computeroutput"><span class="identifier">BOOST_THREAD_USES_DATETIME</span></code>
807 if you want to use Boost.DateTime related interfaces.
809 <div class="warning"><table border="0" summary="Warning">
811 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../doc/src/images/warning.png"></td>
812 <th align="left">Warning</th>
814 <tr><td align="left" valign="top"><p>
815 When defined BOOST_THREAD_PLATFORM_WIN32 BOOST_THREAD_USES_DATETIME is
816 defined independently of user settings.
820 <div class="section">
821 <div class="titlepage"><div><div><h4 class="title">
822 <a name="thread.build.configuration.move0"></a><a class="link" href="build.html#thread.build.configuration.move0" title="Boost.Atomic">Boost.Atomic</a>
823 </h4></div></div></div>
825 Boost.Thread uses by default an Boost.Atomic in POSIX platforms to implement
829 Define <code class="computeroutput"><span class="identifier">BOOST_THREAD_USES_ATOMIC</span>
830 </code> if you want to use Boost.Atomic. Define <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_USE_ATOMIC</span>
831 </code> if you don't want to use Boost.Atomic or if it is not supported
835 <div class="section">
836 <div class="titlepage"><div><div><h4 class="title">
837 <a name="thread.build.configuration.thread_eq"></a><a class="link" href="build.html#thread.build.configuration.thread_eq" title="boost::thread::operator== deprecated"><code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">thread</span><span class="special">::</span><span class="keyword">operator</span><span class="special">==</span></code>
839 </h4></div></div></div>
841 The following operators are deprecated:
843 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
844 <li class="listitem">
845 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">thread</span><span class="special">::</span><span class="keyword">operator</span><span class="special">==</span></code>
847 <li class="listitem">
848 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">thread</span><span class="special">::</span><span class="keyword">operator</span><span class="special">!=</span></code>
852 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_THREAD_EQ</span></code>
853 is defined Boost.Thread provides these deprecated feature.
858 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
859 <li class="listitem">
860 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">thread</span><span class="special">::</span><span class="identifier">id</span><span class="special">::</span><span class="keyword">operator</span><span class="special">==</span></code>
862 <li class="listitem">
863 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">thread</span><span class="special">::</span><span class="identifier">id</span><span class="special">::</span><span class="keyword">operator</span><span class="special">!=</span></code>
866 <div class="warning"><table border="0" summary="Warning">
868 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../doc/src/images/warning.png"></td>
869 <th align="left">Warning</th>
871 <tr><td align="left" valign="top"><p>
872 This is a breaking change respect to version 1.x.
876 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">>=</span><span class="number">4</span></code> define
877 <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_THREAD_EQ</span>
878 </code> if you want this feature. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special"><</span><span class="number">4</span></code> define
879 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_THREAD_EQ</span>
880 </code> if you don't want this feature.
883 <div class="section">
884 <div class="titlepage"><div><div><h4 class="title">
885 <a name="thread.build.configuration.condition"></a><a class="link" href="build.html#thread.build.configuration.condition" title="boost::condition deprecated">boost::condition
887 </h4></div></div></div>
889 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">condition</span></code> is deprecated. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_CONDITION</span></code> is defined
890 Boost.Thread provides this deprecated feature.
893 Use instead <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">condition_variable_any</span></code>.
895 <div class="warning"><table border="0" summary="Warning">
897 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../doc/src/images/warning.png"></td>
898 <th align="left">Warning</th>
900 <tr><td align="left" valign="top"><p>
901 This is a breaking change respect to version 1.x.
905 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">></span><span class="number">3</span></code> define
906 <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_CONDITION</span></code>
907 if you want this feature. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special"><=</span><span class="number">3</span></code> define
908 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_CONDITION</span></code>
909 if you don't want this feature.
912 <div class="section">
913 <div class="titlepage"><div><div><h4 class="title">
914 <a name="thread.build.configuration.nested_lock"></a><a class="link" href="build.html#thread.build.configuration.nested_lock" title="Mutex nested lock types deprecated">Mutex nested
915 lock types deprecated</a>
916 </h4></div></div></div>
918 The following nested typedefs are deprecated:
920 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
921 <li class="listitem">
922 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mutex</span><span class="special">::</span><span class="identifier">scoped_lock</span></code>,
924 <li class="listitem">
925 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mutex</span><span class="special">::</span><span class="identifier">scoped_try_lock</span></code>,
927 <li class="listitem">
928 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">timed_mutex</span><span class="special">::</span><span class="identifier">scoped_lock</span></code>
930 <li class="listitem">
931 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">timed_mutex</span><span class="special">::</span><span class="identifier">scoped_try_lock</span></code>
933 <li class="listitem">
934 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">timed_mutex</span><span class="special">::</span><span class="identifier">timed_scoped_timed_lock</span></code>
936 <li class="listitem">
937 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_mutex</span><span class="special">::</span><span class="identifier">scoped_lock</span></code>,
939 <li class="listitem">
940 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_mutex</span><span class="special">::</span><span class="identifier">scoped_try_lock</span></code>,
942 <li class="listitem">
943 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_timed_mutex</span><span class="special">::</span><span class="identifier">scoped_lock</span></code>
945 <li class="listitem">
946 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_timed_mutex</span><span class="special">::</span><span class="identifier">scoped_try_lock</span></code>
948 <li class="listitem">
949 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_timed_mutex</span><span class="special">::</span><span class="identifier">timed_scoped_timed_lock</span></code>
953 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_NESTED_LOCKS</span></code>
954 is defined Boost.Thread provides these deprecated feature.
957 Use instead * <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unique_lock</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mutex</span><span class="special">></span></code>,
958 * <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unique_lock</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">mutex</span><span class="special">></span></code>
959 with the <code class="computeroutput"><span class="identifier">try_to_lock_t</span></code>
960 constructor, * <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unique_lock</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">timed_mutex</span><span class="special">></span></code>
961 * <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unique_lock</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">timed_mutex</span><span class="special">></span></code>
962 with the <code class="computeroutput"><span class="identifier">try_to_lock_t</span></code>
963 constructor * <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unique_lock</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">timed_mutex</span><span class="special">></span></code>
964 * <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unique_lock</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_mutex</span><span class="special">></span></code>,
965 * <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unique_lock</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_mutex</span><span class="special">></span></code>
966 with the <code class="computeroutput"><span class="identifier">try_to_lock_t</span></code>
967 constructor, * <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unique_lock</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_timed_mutex</span><span class="special">></span></code>
968 * <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unique_lock</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_timed_mutex</span><span class="special">></span></code>
969 with the <code class="computeroutput"><span class="identifier">try_to_lock_t</span></code>
970 constructor * <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unique_lock</span><span class="special"><</span><span class="identifier">boost</span><span class="special">::</span><span class="identifier">recursive_timed_mutex</span><span class="special">></span></code>
972 <div class="warning"><table border="0" summary="Warning">
974 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../doc/src/images/warning.png"></td>
975 <th align="left">Warning</th>
977 <tr><td align="left" valign="top"><p>
978 This is a breaking change respect to version 1.x.
982 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">>=</span><span class="number">4</span></code> define
983 <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_NESTED_LOCKS</span></code>
984 if you want these features. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special"><</span><span class="number">4</span></code> define
985 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_NESTED_LOCKS</span></code>
986 if you don't want thes features.
989 <div class="section">
990 <div class="titlepage"><div><div><h4 class="title">
991 <a name="thread.build.configuration.id"></a><a class="link" href="build.html#thread.build.configuration.id" title="thread::id">thread::id</a>
992 </h4></div></div></div>
994 Boost.Thread uses by default a thread::id on Posix based on the pthread
995 type (BOOST_THREAD_PROVIDES_BASIC_THREAD_ID). For backward compatibility
996 and also for compilers that don't work well with this modification the
997 user can define <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_BASIC_THREAD_ID</span></code>.
1000 Define <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_BASIC_THREAD_ID</span>
1001 </code> if you don't want these features.
1004 <div class="section">
1005 <div class="titlepage"><div><div><h4 class="title">
1006 <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
1008 </h4></div></div></div>
1010 The shared mutex implementation on Windows platform provides currently
1011 less functionality than the generic one that is used for PTheads based
1012 platforms. In order to have access to these functions, the user needs to
1013 define <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN</span></code>
1014 to use the generic implementation, that while could be less efficient,
1015 provides all the functions.
1018 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
1019 <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN</span>
1020 </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
1021 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_GENERIC_SHARED_MUTEX_ON_WIN</span>
1022 </code> if you don't want these features.
1025 <div class="section">
1026 <div class="titlepage"><div><div><h4 class="title">
1027 <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
1028 Upwards Conversion</a>
1029 </h4></div></div></div>
1031 Boost.Threads includes in version 3 the Shared Locking Upwards Conversion
1032 as defined in <a href="http://home.roadrunner.com/~hinnant/bloomington/shared_mutex.html" target="_top">Shared
1033 Locking</a>. These conversions need to be used carefully to avoid deadlock
1034 or livelock. The user need to define explicitly <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSION</span></code>
1035 to get these upwards conversions.
1038 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
1039 <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSION</span>
1040 </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
1041 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_SHARED_MUTEX_UPWARDS_CONVERSION</span>
1042 </code> if you don't want these features.
1045 <div class="section">
1046 <div class="titlepage"><div><div><h4 class="title">
1047 <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
1049 </h4></div></div></div>
1051 In <a href="http://home.roadrunner.com/~hinnant/bloomington/shared_mutex.html" target="_top">Shared
1052 Locking</a> the lock conversions are explicit. As this explicit conversion
1053 breaks the lock interfaces, it is provided only if the <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION</span></code>
1057 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
1058 <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION</span>
1059 </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
1060 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_EXPLICIT_LOCK_CONVERSION</span>
1061 </code> if you don't want these features.
1064 <div class="section">
1065 <div class="titlepage"><div><div><h4 class="title">
1066 <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
1068 </h4></div></div></div>
1070 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
1071 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>.
1072 Since version 3.0.0 <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">future</span></code>
1073 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>
1074 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>.
1077 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
1078 <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_FUTURE</span></code>
1079 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
1080 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_FUTURE</span></code>
1081 if you want to use boost::unique_future.
1084 <div class="section">
1085 <div class="titlepage"><div><div><h4 class="title">
1086 <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>
1087 </h4></div></div></div>
1089 C++11 promise initialize the associated state at construction time. Versions
1090 of Boost.Thread previous to version 3.0.0 initialize it lazily at any point
1091 in time in which this associated state is needed.
1094 Since version 3.0.0 this difference in behavior can be configured. When
1095 <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_PROMISE_LAZY</span></code>
1096 is defined the backward compatible behavior is provided.
1099 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
1100 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_PROMISE_LAZY</span>
1101 </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
1102 <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_PROMISE_LAZY</span>
1103 </code> if you want to use boost::unique_future.
1106 <div class="section">
1107 <div class="titlepage"><div><div><h4 class="title">
1108 <a name="thread.build.configuration.alloc"></a><a class="link" href="build.html#thread.build.configuration.alloc" title="promise Allocator constructor">promise Allocator
1110 </h4></div></div></div>
1112 C++11 std::promise provides constructors with allocators.
1114 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">typename</span> <span class="identifier">R</span><span class="special">></span>
1115 <span class="keyword">class</span> <span class="identifier">promise</span>
1116 <span class="special">{</span>
1117 <span class="keyword">public</span><span class="special">:</span>
1118 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">Allocator</span><span class="special">></span>
1119 <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>
1120 <span class="comment">// ...</span>
1121 <span class="special">};</span>
1122 <span class="keyword">template</span> <span class="special"><</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">></span> <span class="keyword">struct</span> <span class="identifier">uses_allocator</span><span class="special"><</span><span class="identifier">promise</span><span class="special"><</span><span class="identifier">R</span><span class="special">>,</span><span class="identifier">Alloc</span><span class="special">>:</span> <span class="identifier">true_type</span> <span class="special">{};</span>
1127 <pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">allocator_arg_t</span> <span class="special">{</span> <span class="special">};</span>
1128 <span class="keyword">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>
1130 <span class="keyword">template</span> <span class="special"><</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">></span> <span class="keyword">struct</span> <span class="identifier">uses_allocator</span><span class="special">;</span>
1133 Since version 3.0.0 Boost.Thread implements this constructor using the
1136 <pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span>
1137 <span class="special">{</span>
1138 <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>
1139 <span class="keyword">constexpr</span> <span class="identifier">allocator_arg_t</span> <span class="identifier">allocator_arg</span> <span class="special">=</span> <span class="special">{};</span>
1141 <span class="keyword">namespace</span> <span class="identifier">container</span>
1142 <span class="special">{</span>
1143 <span class="keyword">template</span> <span class="special"><</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">></span>
1144 <span class="keyword">struct</span> <span class="identifier">uses_allocator</span><span class="special"><</span><span class="identifier">promise</span><span class="special"><</span><span class="identifier">R</span><span class="special">>,</span><span class="identifier">Alloc</span><span class="special">>:</span> <span class="identifier">true_type</span> <span class="special">{};</span>
1145 <span class="special">}</span>
1146 <span class="keyword">template</span> <span class="special"><</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">></span>
1147 <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"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">Alloc</span><span class="special">></span> <span class="special">{};</span>
1148 <span class="special">}</span>
1151 which introduces a dependency on Boost.Container. This feature is provided
1152 only if <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS</span></code>
1156 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
1157 <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS</span>
1158 </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
1159 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS</span>
1160 </code> if you don't want these features.
1163 <div class="section">
1164 <div class="titlepage"><div><div><h4 class="title">
1165 <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
1167 </h4></div></div></div>
1169 C++11 has a different semantic for the thread destructor and the move assignment.
1170 Instead of detaching the thread, calls to terminate() if the thread was
1171 joinable. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE</span></code>
1172 and <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE</span></code>
1173 is defined Boost.Thread provides the C++ semantic.
1176 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
1177 <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE</span>
1178 </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
1179 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE</span>
1180 </code> if you don't want these features.
1183 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
1184 <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE</span>
1185 </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
1186 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE</span>
1187 </code> if you don't want these features.
1190 <div class="section">
1191 <div class="titlepage"><div><div><h4 class="title">
1192 <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>
1193 </h4></div></div></div>
1195 C++11 defines a default constructor for once_flag. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_ONCE_CXX11</span>
1196 </code> is defined Boost.Thread provides this C++ semantics. In this case,
1197 the previous aggregate syntax is not supported.
1199 <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>
1202 You should now just do
1204 <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>
1207 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">==</span><span class="number">2</span></code> define
1208 <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_ONCE_CXX11</span></code>
1209 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
1210 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_ONCE_CXX11</span></code>
1211 if you don't want these features.
1214 <div class="section">
1215 <div class="titlepage"><div><div><h4 class="title">
1216 <a name="thread.build.configuration.deprecated"></a><a class="link" href="build.html#thread.build.configuration.deprecated" title="Signature parameter for packaged_task">Signature parameter
1217 for packaged_task</a>
1218 </h4></div></div></div>
1220 C++11 packaged task class has a Signature template parameter. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK</span>
1221 </code> is defined Boost.Thread provides this C++ feature.
1223 <div class="warning"><table border="0" summary="Warning">
1225 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../doc/src/images/warning.png"></td>
1226 <th align="left">Warning</th>
1228 <tr><td align="left" valign="top"><p>
1229 This is a breaking change respect to version 3.x.
1233 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special"><</span><span class="number">4</span></code> define
1234 <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK</span></code>
1235 if you want this feature. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">>=</span><span class="number">4</span></code> define
1236 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_SIGNATURE_PACKAGED_TASK</span></code>
1237 if you don't want this feature.
1240 <div class="section">
1241 <div class="titlepage"><div><div><h4 class="title">
1242 <a name="thread.build.configuration.thread_const"></a><a class="link" href="build.html#thread.build.configuration.thread_const" title="-var thread constructor with variadic rvalue parameters">-var thread
1243 constructor with variadic rvalue parameters</a>
1244 </h4></div></div></div>
1246 C++11 thread constructor accep a variable number of rvalue argumentshas.
1247 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_VARIADIC_THREAD</span>
1248 </code> is defined Boost.Thread provides this C++ feature if the following
1251 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1252 <li class="listitem">
1253 BOOST_NO_SFINAE_EXPR
1255 <li class="listitem">
1256 BOOST_NO_CXX11_VARIADIC_TEMPLATES
1258 <li class="listitem">
1259 BOOST_NO_CXX11_DECLTYPE
1261 <li class="listitem">
1262 BOOST_NO_CXX11_DECLTYPE_N3276
1264 <li class="listitem">
1265 BOOST_NO_CXX11_RVALUE_REFERENCES
1267 <li class="listitem">
1268 BOOST_NO_CXX11_TRAILING_RESULT_TYPES
1270 <li class="listitem">
1271 BOOST_NO_CXX11_RVALUE_REFERENCES
1273 <li class="listitem">
1274 BOOST_NO_CXX11_HDR_TUPLE
1278 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">></span><span class="number">4</span></code> define
1279 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_VARIADIC_THREAD</span>
1280 </code> if you don't want this feature.
1283 <div class="section">
1284 <div class="titlepage"><div><div><h4 class="title">
1285 <a name="thread.build.configuration.get_invalid"></a><a class="link" href="build.html#thread.build.configuration.get_invalid" title="future<>::get() invalidates the future">future<>::get()
1286 invalidates the future</a>
1287 </h4></div></div></div>
1289 C++11 future<>::get() invalidates the future once its value has been
1290 obtained. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_FUTURE_INVALID_AFTER_GET</span>
1291 </code> is defined Boost.Thread provides this C++ feature.
1293 <div class="warning"><table border="0" summary="Warning">
1295 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../doc/src/images/warning.png"></td>
1296 <th align="left">Warning</th>
1298 <tr><td align="left" valign="top"><p>
1299 This is a breaking change respect to version 3.x.
1303 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special"><</span><span class="number">4</span></code> define
1304 <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_FUTURE_INVALID_AFTER_GET</span></code>
1305 if you want this feature. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span><span class="special">>=</span><span class="number">4</span></code> define
1306 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_FUTURE_INVALID_AFTER_GET</span></code>
1307 if you don't want this feature.
1310 <div class="section">
1311 <div class="titlepage"><div><div><h4 class="title">
1312 <a name="thread.build.configuration.intr"></a><a class="link" href="build.html#thread.build.configuration.intr" title="Interruptions">Interruptions</a>
1313 </h4></div></div></div>
1315 Thread interruption, while useful, makes any interruption point less efficient
1316 than if the thread were not interruptible.
1319 When <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_INTERRUPTIONS</span></code>
1320 is defined Boost.Thread provides interruptions. When <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_INTERRUPTIONS</span></code>
1321 is defined Boost.Thread don't provide interruption.
1324 Boost.Thread defines BOOST_THREAD_PROVIDES_INTERRUPTIONS if neither BOOST_THREAD_PROVIDES_INTERRUPTIONS
1325 nor BOOST_THREAD_DONT_PROVIDE_INTERRUPTIONS are defined, so that there
1326 is no compatibility break.
1329 <div class="section">
1330 <div class="titlepage"><div><div><h4 class="title">
1331 <a name="thread.build.configuration.version"></a><a class="link" href="build.html#thread.build.configuration.version" title="Version">Version</a>
1332 </h4></div></div></div>
1334 <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span></code> defines
1335 the Boost.Thread version. The default version is 2. In this case the following
1336 breaking or extending macros are defined if the opposite is not requested:
1338 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
1339 <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_PROMISE_LAZY</span></code>
1342 The user can request the version 3 by defining <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span></code>
1343 to 3. In this case the following breaking or extending macros are defined
1344 if the opposite is not requested:
1346 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1347 <li class="listitem">
1348 Breaking change <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION</span>
1351 <li class="listitem">
1352 Conformity & Breaking change <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_FUTURE</span></code>
1354 <li class="listitem">
1355 Uniformity <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN</span></code>
1357 <li class="listitem">
1358 Extension <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSION</span></code>
1360 <li class="listitem">
1361 Conformity <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS</span></code>
1363 <li class="listitem">
1364 Conformity & Breaking change BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE
1366 <li class="listitem">
1367 Conformity & Breaking change BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE
1369 <li class="listitem">
1370 Conformity & Breaking change <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_ONCE_CXX11</span></code>
1372 <li class="listitem">
1373 Breaking change <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_PROMISE_LAZY</span></code>
1377 The user can request the version 4 by defining <code class="computeroutput"><span class="identifier">BOOST_THREAD_VERSION</span></code>
1378 to 4. In this case the following breaking or extending macros are defined
1379 if the opposite is not requested:
1381 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1382 <li class="listitem">
1383 Conformity & Breaking change <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK</span>
1386 <li class="listitem">
1387 Conformity & Breaking change <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_FUTURE_INVALID_AFTER_GET</span>
1390 <li class="listitem">
1391 Conformity <code class="computeroutput"><span class="identifier">BOOST_THREAD_PROVIDES_VARIADIC_THREAD</span></code>
1393 <li class="listitem">
1394 Breaking change <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_THREAD_EQ</span></code>
1396 <li class="listitem">
1397 Breaking change <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_USE_DATETIME</span></code>
1402 <div class="section">
1403 <div class="titlepage"><div><div><h3 class="title">
1404 <a name="thread.build.limitations"></a><a class="link" href="build.html#thread.build.limitations" title="Limitations">Limitations</a>
1405 </h3></div></div></div>
1406 <div class="toc"><dl class="toc">
1407 <dt><span class="section"><a href="build.html#thread.build.limitations.sun">SunPro</a></span></dt>
1408 <dt><span class="section"><a href="build.html#thread.build.limitations.vacpp">VACPP</a></span></dt>
1409 <dt><span class="section"><a href="build.html#thread.build.limitations.ce">WCE</a></span></dt>
1412 Some compilers don't work correctly with some of the added features.
1414 <div class="section">
1415 <div class="titlepage"><div><div><h4 class="title">
1416 <a name="thread.build.limitations.sun"></a><a class="link" href="build.html#thread.build.limitations.sun" title="SunPro">SunPro</a>
1417 </h4></div></div></div>
1419 If __SUNPRO_CC < 0x5100 the library defines
1421 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
1422 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_USE_MOVE</span></code>
1425 If __SUNPRO_CC < 0x5100 the library defines
1427 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
1428 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS</span></code>
1431 <div class="section">
1432 <div class="titlepage"><div><div><h4 class="title">
1433 <a name="thread.build.limitations.vacpp"></a><a class="link" href="build.html#thread.build.limitations.vacpp" title="VACPP">VACPP</a>
1434 </h4></div></div></div>
1436 If __IBMCPP__ < 1100 the library defines
1438 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1439 <li class="listitem">
1440 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_USE_CHRONO</span></code>
1442 <li class="listitem">
1443 <code class="computeroutput"><span class="identifier">BOOST_THREAD_USES_DATE</span></code>
1447 And Boost.Thread doesn't links with Boost.Chrono.
1450 <div class="section">
1451 <div class="titlepage"><div><div><h4 class="title">
1452 <a name="thread.build.limitations.ce"></a><a class="link" href="build.html#thread.build.limitations.ce" title="WCE">WCE</a>
1453 </h4></div></div></div>
1455 If _WIN32_WCE && _WIN32_WCE==0x501 the library defines
1457 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
1458 <code class="computeroutput"><span class="identifier">BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS</span></code>
1463 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
1464 <td align="left"></td>
1465 <td align="right"><div class="copyright-footer">Copyright © 2007 -11 Anthony Williams<br>Copyright © 2011 -14 Vicente J. Botet Escriba<p>
1466 Distributed under the Boost Software License, Version 1.0. (See accompanying
1467 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>)
1472 <div class="spirit-nav">
1473 <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>