mirror of
https://github.com/boostorg/thread.git
synced 2026-02-03 09:42:16 +00:00
Compare commits
1 Commits
boost-1.52
...
boost-1.50
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87a0e26efb |
@@ -40,14 +40,11 @@ import path ;
|
||||
project boost/thread
|
||||
: source-location ../src
|
||||
: requirements <threading>multi
|
||||
#<link>static:<define>BOOST_THREAD_STATIC_LINK=1
|
||||
#<link>shared:<define>BOOST_THREAD_DYN_LINK=1
|
||||
<link>static:<define>BOOST_THREAD_BUILD_LIB=1
|
||||
<link>shared:<define>BOOST_THREAD_BUILD_DLL=1
|
||||
-<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
|
||||
<tag>@$(__name__).tag
|
||||
<toolset>gcc:<cxxflags>-Wno-long-long
|
||||
<define>BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED
|
||||
<define>BOOST_SYSTEM_NO_DEPRECATED
|
||||
<library>/boost/system//boost_system
|
||||
#-pedantic -ansi -std=gnu++0x -Wextra -fpermissive
|
||||
@@ -88,18 +85,15 @@ project boost/thread
|
||||
#<toolset>clang-2.8:<cxxflags>-Wno-unused-function
|
||||
#<toolset>clang-2.9:<cxxflags>-Wno-delete-non-virtual-dtor
|
||||
#<toolset>clang-2.9:<cxxflags>-Wno-unused-function
|
||||
<toolset>clang-3.0:<cxxflags>-Wno-delete-non-virtual-dtor
|
||||
<toolset>clang-3.0:<cxxflags>-Wno-delete-non-virtual-dtor
|
||||
#<toolset>clang-3.0:<cxxflags>-Wno-unused-function
|
||||
#<toolset>clang-3.0:<cxxflags>-Wno-unused-variable
|
||||
|
||||
|
||||
# : default-build <threading>multi
|
||||
: usage-requirements # pass these requirement to dependents (i.e. users)
|
||||
#<link>static:<define>BOOST_THREAD_STATIC_LINK=1
|
||||
#<link>shared:<define>BOOST_THREAD_DYN_LINK=1
|
||||
<link>static:<define>BOOST_THREAD_BUILD_LIB=1
|
||||
<link>shared:<define>BOOST_THREAD_BUILD_DLL=1
|
||||
<define>BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED
|
||||
<define>BOOST_SYSTEM_NO_DEPRECATED
|
||||
<library>/boost/system//boost_system
|
||||
;
|
||||
@@ -213,7 +207,7 @@ rule usage-requirements ( properties * )
|
||||
if ! <toolset>vacpp in $(properties) || <toolset-vacpp:version>11.1 in $(properties)
|
||||
{
|
||||
result += <library>/boost/chrono//boost_chrono ;
|
||||
}
|
||||
}
|
||||
|
||||
return $(result) ;
|
||||
}
|
||||
@@ -238,7 +232,10 @@ rule requirements ( properties * )
|
||||
}
|
||||
}
|
||||
}
|
||||
result += <define>BOOST_THREAD_DONT_USE_CHRONO ;
|
||||
if ! <toolset>vacpp in $(properties) || <toolset-vacpp:version>11.1 in $(properties)
|
||||
{
|
||||
result += <library>/boost/chrono//boost_chrono ;
|
||||
}
|
||||
|
||||
return $(result) ;
|
||||
}
|
||||
|
||||
127
doc/changes.qbk
127
doc/changes.qbk
@@ -8,102 +8,8 @@
|
||||
|
||||
[section:changes History]
|
||||
|
||||
[heading Version 3.1.0 - boost 1.52]
|
||||
|
||||
Deprecated Features:
|
||||
|
||||
Deprecated features since boost 1.50 available only until boost 1.55:
|
||||
|
||||
These deprecated features will be provided by default up to boost 1.52. If you don't want to include the deprecated features you could define BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0. Since 1.53 these features will not be included any more by default. Since this version, if you want to include the deprecated features yet you could define BOOST_THREAD_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0. These deprecated features will be only available until boost 1.55, that is you have yet 1 year to move to the new features.
|
||||
|
||||
* Time related functions don't using the Boost.Chrono library, use the chrono overloads instead.
|
||||
|
||||
Breaking changes when BOOST_THREAD_VERSION==3 (Default value since Boost 1.53):
|
||||
|
||||
There are some new features which share the same interface but with different behavior. These breaking features are provided by default when BOOST_THREAD_VERSION is 3, but the user can however choose the version 2 behavior by defining the corresponding macro. As for the deprecated features, these broken features will be only available until boost 1.55.
|
||||
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6229 #6229] Rename the unique_future to future following the c++11.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6266 #6266] Breaking change: thread destructor should call terminate if joinable.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6269 #6269] Breaking change: thread move assignment should call terminate if joinable.
|
||||
|
||||
New Features:
|
||||
|
||||
* [@http://svn.boost.org/trac/boost/ticket/2361 #2361] thread_specific_ptr: document nature of the key, complexity and rationale.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/4710 #4710] C++11 compliance: Missing async().
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7283 #7283] C++11 compliance: Add notify_all_at_thread_exit.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7345 #7345] C++11 compliance: Add noexcept to recursive mutex try_lock.
|
||||
|
||||
Fixed Bugs:
|
||||
|
||||
* [@http://svn.boost.org/trac/boost/ticket/2797 #2797] Two problems with thread_specific_ptr.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/5274 #5274] failed to compile future.hpp with stlport 5.1.5 under msvc8.1, because of undefined class.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/5431 #5431] compile error in Windows CE 6.0(interlocked).
|
||||
[/* [@http://svn.boost.org/trac/boost/ticket/5752 #5752] boost::call_once() is unreliable on some platforms.]
|
||||
* [@http://svn.boost.org/trac/boost/ticket/5696 #5696] win32 detail::set_tss_data does nothing when tss_cleanup_function is NULL.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6931 #6931] mutex waits forwever with Intel C++ Compiler XE 12.1.5.344 Build 20120612
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7045 #7045] Thread library does not automatically compile date_time.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7173 #7173] wrong function name interrupt_point().
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7200 #7200] Unable to build boost.thread modularized.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7220 #7220] gcc 4.6.2 warns about inline+dllimport functions.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7238 #7238] this_thread::sleep_for() does not respond to interrupt().
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7245 #7245] Minor typos on documentation related to version 3.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7272 #7272] win32/thread_primitives.hpp: (Unneccessary) Warning.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7284 #7284] Clarify that there is no access priority between lock and shared_lock on shared mutex.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7329 #7329] boost/thread/future.hpp does not compile on HPUX.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7336 #7336] BOOST_THREAD_DONT_USE_SYSTEM doesn't work.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7329 #7349] packaged_task holds reference to temporary.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7350 #7350] allocator_destructor does not destroy object
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7360 #7360] Memory leak in pthread implementation of boost::thread_specific_ptr
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7370 #7370] Boost.Thread documentation
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7438 #7438] Segmentation fault in test_once regression test in group.join_all();
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7461 #7461] detail::win32::ReleaseSemaphore may be called with count_to_release equal to 0
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7499 #7499] call_once doesn't call even once
|
||||
|
||||
[heading Version 3.0.1 - boost 1.51]
|
||||
|
||||
Deprecated Features:
|
||||
|
||||
Deprecated features since boost 1.50 available only until boost 1.55:
|
||||
|
||||
These deprecated features will be provided by default up to boost 1.52. If you don't want to include the deprecated features you could define BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0. Since 1.53 these features will not be included any more by default. Since this version, if you want to include the deprecated features yet you could define BOOST_THREAD_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0. These deprecated features will be only available until boost 1.55, that is you have 1 year and a half to move to the new features.
|
||||
|
||||
* Time related functions don't using the Boost.Chrono library, use the chrono overloads instead.
|
||||
|
||||
Breaking changes when BOOST_THREAD_VERSION==3:
|
||||
|
||||
There are some new features which share the same interface but with different behavior. These breaking features are provided by default when BOOST_THREAD_VERSION is 3, but the user can however choose the version 2 behavior by defining the corresponding macro. As for the deprecated features, these broken features will be only available until boost 1.55.
|
||||
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6229 #6229] Rename the unique_future to future following the c++11.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6266 #6266] Breaking change: thread destructor should call terminate if joinable.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6269 #6269] Breaking change: thread move assignment should call terminate if joinable.
|
||||
|
||||
|
||||
Fixed Bugs:
|
||||
|
||||
|
||||
* [@http://svn.boost.org/trac/boost/ticket/4258 #4258] Linking with boost thread does not work on mingw/gcc 4.5.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/4885 #4885] Access violation in set_tss_data at process exit due to invalid assumption about TlsAlloc.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6931 #6931] mutex waits forwever with Intel Compiler and /debug:parallel
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7044 #7044] boost 1.50.0 header missing.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7052 #7052] Thread: BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 only masks thread::operator==, thread::operator!= forward declarations, not definitions.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7066 #7066] An attempt to fix current_thread_tls_key static initialization order.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7074 #7074] Multiply defined symbol boost::allocator_arg.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7078 #7078] Trivial 64-bit warning fix on Windows for thread attribute stack size
|
||||
* [@http://svn.boost.org/trac/boost/ticket/7089 #7089] BOOST_THREAD_WAIT_BUG limits functionality without solving anything
|
||||
|
||||
[/
|
||||
#6787 boost::thread::sleep() hangs if system time is rolled back
|
||||
#7045 Thread library does not automatically compile date_time
|
||||
]
|
||||
|
||||
[heading Version 3.0.0 - boost 1.50]
|
||||
|
||||
Breaking changes when BOOST_THREAD_VERSION==3:
|
||||
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6229 #6229] Breaking change: Rename the unique_future to future following the c++11.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6266 #6266] Breaking change: thread destructor should call terminate if joinable.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6269 #6269] Breaking change: thread move assignment should call terminate if joinable.
|
||||
|
||||
New Features:
|
||||
|
||||
* [@http://svn.boost.org/trac/boost/ticket/1850 #1850] Request for unlock_guard to compliment lock_guard.
|
||||
@@ -114,31 +20,25 @@ New Features:
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6195 #6195] c++11 compliance: Provide the standard time related interface using Boost.Chrono.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6217 #6217] Enhance Boost.Thread shared mutex interface following Howard Hinnant proposal.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6224 #6224] c++11 compliance: Add the use of standard noexcept on compilers supporting them.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6225 #6225] Add the use of standard =delete defaulted operations on compilers supporting them.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6226 #6226] c++11 compliance: Add explicit bool conversion from locks.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6228 #6228] Add promise constructor with allocator following the standard c++11.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6230 #6230] c++11 compliance: Follows the exception reporting mechanism as defined in the c++11.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6231 #6231] Add BasicLockable requirements in the documentation to follow c++11.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6266 #6266] Breaking change: thread destructor should call terminate if joinable.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6269 #6269] Breaking change: thread move assignment should call terminate if joinable.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6272 #6272] c++11 compliance: Add thread::id hash specialization.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6273 #6273] c++11 compliance: Add cv_status enum class and use it on the conditions wait functions.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6231 #6231] Add BasicLockable requirements in the documentation to follow c++11.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6342 #6342] c++11 compliance: Adapt the one_flag to the c++11 interface.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6671 #6671] upgrade_lock: missing mutex and release functions.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6672 #6672] upgrade_lock:: missing constructors from time related types.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6675 #6675] upgrade_lock:: missing non-member swap.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6676 #6676] lock conversion should be explicit.
|
||||
* Added missing packaged_task::result_type and packaged_task:: constructor with allocator.
|
||||
* Added packaged_task::reset()
|
||||
|
||||
|
||||
Fixed Bugs:
|
||||
|
||||
* [@http://svn.boost.org/trac/boost/ticket/2380 #2380] boost::move from lvalue does not work with gcc.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/2430 #2430] shared_mutex for win32 doesn't have timed_lock_upgrade.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/2575 #2575] Bug- Boost 1.36.0 on Itanium platform.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/3160 #3160] Duplicate tutorial code in boost::thread.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/4345 #4345] thread::id and joining problem with cascade of threads.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/4521 #4521] Error using boost::move on packaged_task (MSVC 10).
|
||||
* [@http://svn.boost.org/trac/boost/ticket/4711 #4711] Must use implementation details to return move-only types.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/4921 #4921] BOOST_THREAD_USE_DLL and BOOST_THREAD_USE_LIB are crucial and need to be documented.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/5013 #5013] documentation: boost::thread: pthreas_exit causes terminate().
|
||||
* [@http://svn.boost.org/trac/boost/ticket/5173 #5173] boost::this_thread::get_id is very slow.
|
||||
@@ -147,15 +47,24 @@ Fixed Bugs:
|
||||
* [@http://svn.boost.org/trac/boost/ticket/5990 #5990] shared_future<T>::get() has wrong return type.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6174 #6174] packaged_task doesn't correctly handle moving results.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6222 #6222] Compile error with SunStudio: unique_future move.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6354 #6354] PGI: Compiler threading support is not turned on.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6673 #6673] shared_lock: move assign doesn't works with c++11.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6674 #6674] shared_mutex: try_lock_upgrade_until doesn't works.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6908 #6908] Compile error due to unprotected definitions of _WIN32_WINNT and WINVER.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6940 #6940] TIME_UTC is a macro in C11.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6959 #6959] call of abs is ambiguous.
|
||||
* Fix issue signaled on the ML with task_object(task_object const&) in presence of task_object(task_object &&)
|
||||
|
||||
|
||||
[/
|
||||
Deprecated features since boost 1.50 available only until boost 1.55:
|
||||
|
||||
These deprecated features will be provided by default up to boost 1.52. If you don't want to include the deprecated features you could define BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0. Since 1.53 these features will not be included any more by default. Since this version, if you want to include the deprecated features yet you could define BOOST_THREAD_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0. These deprecated features will be only available until boost 1.55, that is you have 1 year and a half to move to the new features.
|
||||
|
||||
* Time related functions don't using the Boost.Chrono library, use the chrono overloads instead.
|
||||
|
||||
Breaking changes:
|
||||
|
||||
There are some new features which share the same interface but with different behavior. These breaking features are provided by default when BOOST_THREAD_VERSION is 2, but the user can however choose the version 1 behavior by defining the corresponding macro. As for the deprecated features, these broken features will be only available until boost 1.55.
|
||||
|
||||
* #6266 c++11 compliance: thread destructor should call terminate if joinable
|
||||
* #6269 c++11 compliance: thread move assignment should call terminate if joinable
|
||||
]
|
||||
|
||||
[heading Version 2.1.1 - boost 1.49]
|
||||
|
||||
@@ -275,7 +184,7 @@ The following features will be included in next releases.
|
||||
|
||||
# Complete the C++11 missing features, in particular
|
||||
|
||||
* async with deferred and variadic rvalue reference args.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/4710 #4710] Missing async().
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6227 #6227] Use of variadic templates on Generic Locking Algorithms on compilers providing them.
|
||||
* [@http://svn.boost.org/trac/boost/ticket/6270 #6270] Add thread constructor from movable callable and movable arguments following C++11.
|
||||
|
||||
|
||||
@@ -1,107 +1,97 @@
|
||||
[/
|
||||
(C) Copyright 2011-12 Vicente J. Botet Escriba.
|
||||
(C) Copyright 2011 Vicente J. Botet Escriba.
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
(See accompanying file LICENSE_1_0.txt or copy at
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
[section:compliance Conformance and Extension]
|
||||
[section:compliance Compliance with standard]
|
||||
|
||||
[section:cpp11 C++11 standard Thread library]
|
||||
|
||||
|
||||
[table C++11 standard Conformance
|
||||
[table Compliance C++11 standard
|
||||
[[Section] [Description] [Status] [Comments] [Ticket]]
|
||||
[[30] [Thread support library] [Partial] [-] [-]]
|
||||
[[30.1] [General] [-] [-] [-]]
|
||||
[[30.2] [Requirements] [-] [-] [-]]
|
||||
[[30.2.1] [Template parameter names] [-] [-] [-]]
|
||||
[[30.2.2] [Exceptions] [Yes] [-] [-]]
|
||||
[[30.2.2] [Exceptions] [No] [-] [#12]]
|
||||
[[30.2.3] [Native handles] [Yes] [-] [-]]
|
||||
[[30.2.4] [Timing specifications] [Yes] [-] [-]]
|
||||
[[30.2.5] [Requirements for Lockable types] [Yes] [-] [-]]
|
||||
[[30.2.4] [Timing specifications] [No] [-] [#6195]]
|
||||
[[30.2.5] [Requirements for Lockable types] [Partial] [-] [-]]
|
||||
[[30.2.5.1] [In general] [-] [-] [-]]
|
||||
[[30.2.5.2] [BasicLockable requirements] [Yes] [-] [-]]
|
||||
[[30.2.5.2] [BasicLockable requirements] [No] [-] [#13]]
|
||||
[[30.2.5.3] [Lockable requirements] [yes] [-] [-]]
|
||||
[[30.2.5.4] [TimedLockable requirements] [Yes] [-] [-]]
|
||||
[[30.2.5.4] [TimedLockable requirements] [Partial] [chrono] [#6195]]
|
||||
[[30.2.6] [decay_copy] [-] [-] [-]]
|
||||
[[30.3] [Threads] [Partial] [-] [-]]
|
||||
[[30.3.1] [Class thread] [Partial] [move,variadic,terminate] [#6270]]
|
||||
[[30.3.1.1] [Class thread::id] [Yes] [-] [-]]
|
||||
[[30.3.1.2] [thread constructors] [Partial] [move,variadic] [#6270]]
|
||||
[[30.3.1] [Class thread] [Partial] [-] [-]]
|
||||
[[30.3.1.1] [Class thread::id] [Partial] [Missing noexcept, template <> struct hash<thread::id>] [#3,#4]]
|
||||
[[30.3.1.2] [thread constructors] [Partial] [Missing noexcept and move semantics] [#3,#6194]]
|
||||
[[30.3.1.3] [thread destructor] [Yes] [-] [-]]
|
||||
[[30.3.1.4] [thread assignment] [Yes] [-] [-]]
|
||||
[[30.3.1.5] [thread members] [Yes] [-] [-]]
|
||||
[[30.3.1.6] [thread static members] [Yes] [-] [-]]
|
||||
[[30.3.1.4] [thread assignment] [Partial] [move semantics] [-]]
|
||||
[[30.3.1.5] [thread members] [Partial] [Missing noexcept, chrono] [#3,#6195]]
|
||||
[[30.3.1.6] [thread static members] [Partial] [Missing noexcept] [#3,#6195]]
|
||||
[[30.3.1.7] [thread specialized algorithms] [Yes] [-] [-]]
|
||||
|
||||
[[30.3.2] [Namespace this_thread] [Yes] [-] [-]]
|
||||
[[30.3.2] [Namespace this_thread] [Partial] [chrono] [#6195]]
|
||||
[[30.4] [Mutual exclusion] [Partial] [-] [-]]
|
||||
[[30.4.1] [Mutex requirements] [Yes] [-] [-]]
|
||||
[[30.4.1.1] [In general] [Yes] [-] [-]]
|
||||
[[30.4.1.2] [Mutex types] [Yes] [-] [-]]
|
||||
[[30.4.1.2.1] [Class mutex] [Yes] [-] [-]]
|
||||
[[30.4.1.2.2] [Class recursive_mutex] [Yes] [-] [-]]
|
||||
[[30.4.1.3] [Timed mutex types] [Yes] [-] [-]]
|
||||
[[30.4.1.3.1] [Class timed_mutex] [Yes] [-] [-]]
|
||||
[[30.4.1.3.1] [Class recursive_timed_mutex] [Yes] [-] [-]]
|
||||
[[30.4.2] [Locks] [Partial] [variadic] [#6227]]
|
||||
[[30.4.2.1] [Class template lock_guard] [Yes] [-] [-]]
|
||||
[[30.4.2.2] [Class template unique_lock] [Yes] [-] [-]]
|
||||
[[30.4.2.2.1] [unique_lock constructors, destructor, and assignment] [Yes] [-] [-]]
|
||||
[[30.4.2.2.2] [unique_lock locking] [Yes] [-] [-]]
|
||||
[[30.4.1] [Mutex requirements] [Partial] [-] [-]]
|
||||
[[30.4.1.1] [In general] [Partial] [-] [-]]
|
||||
[[30.4.1.2] [Mutex types] [Partial] [noexcept,delete] [#3,#5]]
|
||||
[[30.4.1.2.1] [Class mutex] [Partial] [noexcept,delete] [#3,#5]]
|
||||
[[30.4.1.2.2] [Class recursive_mutex] [Partial] [noexcept,delete] [#3,#5]]
|
||||
[[30.4.1.3] [Timed mutex types] [Partial] [noexcept,chrono,delete] [#3,#6195,#5]]
|
||||
[[30.4.1.3.1] [Class timed_mutex] [Partial] [noexcept,chrono,delete] [#3,#6195,#5]]
|
||||
[[30.4.1.3.1] [Class recursive_timed_mutex] [Partial] [noexcept,chrono,delete] [#3,#6195,#5]]
|
||||
[[30.4.2] [Locks] [Partial] [noexcept,chrono,move,delete,bool] [#3,#6195,#5,#6]]
|
||||
[[30.4.2.1] [Class template lock_guard] [Partial] [cons/dest delete] [#5]]
|
||||
[[30.4.2.2] [Class template unique_lock] [Partial] [noexcept, chrono, move, delete] [#3,#6195,#5,#6]]
|
||||
[[30.4.2.2.1] [unique_lock constructors, destructor, and assignment] [Partial] [noexcept, chrono, move, delete] [#3,#6195,#5,#6]]
|
||||
[[30.4.2.2.2] [unique_lock locking] [Partial] [chrono] [,#6195,]]
|
||||
[[30.4.2.2.3] [unique_lock modifiers] [Yes] [-] [-]]
|
||||
[[30.4.2.2.4] [unique_lock observers] [Yes] [] [-]]
|
||||
[[30.4.3] [Generic locking algorithms] [Partial] [variadic] [#6227]]
|
||||
[[30.4.4] [Call once] [Partial] [call_once] [#7285]]
|
||||
[[30.4.2.2.4] [unique_lock observers] [Partial] [explicit operator bool] [#6]]
|
||||
[[30.4.3] [Generic locking algorithms] [Partial] [Variadic,] [#7]]
|
||||
[[30.4.4] [Call once] [Partial] [move,variadic] [#6194,#7]]
|
||||
[[30.4.4.1] [Struct once_flag] [Yes] [-] [-]]
|
||||
[[30.4.4.2] [Function call_once] [Partial] [interface] [#7285]]
|
||||
[[30.5] [Condition variables] [Partial] [notify_all_at_thread_exit] [#7283]]
|
||||
[[30.5 6-10] [Function notify_all_at_thread_exit] [No] [-] [#7283]]
|
||||
[[30.5.1] [Class condition_variable] [Yes] [-] [-]]
|
||||
[[30.5.2] [Class condition_variable_any] [Yes] [-] [-]]
|
||||
[[30.6] [Futures] [Partial] [async,at_thread_exit] [#4710,#7280]]
|
||||
[[30.4.4.2] [Function call_once] [Yes] [-] [-]]
|
||||
[[30.5] [Condition variables] [Partial] [chrono,cv_status,notify_all_at_thread_exit] [#6195,#8,#9]]
|
||||
[[30.5 6-10] [Function notify_all_at_thread_exit] [No] [-] [#9]]
|
||||
[[30.5.1] [Class condition_variable] [Partial] [chrono,cv_status] [#6195,#8]]
|
||||
[[30.5.2] [Class condition_variable_any] [Partial] [chrono,cv_status] [#6195,#8]]
|
||||
[[30.6] [Futures] [Partial] [-] [-]]
|
||||
[[30.6.1] [Overview] [Partial] [-] [-]]
|
||||
[[30.6.2] [Error handling] [Yes] [-] [-]]
|
||||
[[30.6.3] [Class future_error] [Partial] [noexcept] [#7279]]
|
||||
[[30.6.4] [Shared state] [-] [-] [-]]
|
||||
[[30.6.5] [Class template promise] [Partial] [at_thread_exit] [#7280]]
|
||||
[[30.6.6] [Class template future] [Yes] [-] [-]]
|
||||
[[30.6.7] [Class template shared_future] [Yes] [-] [-]]
|
||||
[[30.6.8] [Function template async] [Partial] [deferred not implemented and only a copyable functor is allowed yet] [#4710]]
|
||||
[[30.6.9] [Class template packaged_task] [Partial] [args,make_ready_at_thread_exit] [#7281,#7282]]
|
||||
[[30.6.2] [Error handling] [No] [-] [-]]
|
||||
[[30.6.3] [Class future_error] [No] [-] [-]]
|
||||
[[30.6.4] [Shared state] [No] [-] [-]]
|
||||
[[30.6.5] [Class template promise] [Partial] [allocator,move,delete] [#10,#6194,#5]]
|
||||
[[30.6.6] [Class template future] [No] [unique_future is the closest to future] [#11]]
|
||||
[[30.6.7] [Class template shared_future] [Partial] [allocator,move,delete] [#10,#6194,#5]]
|
||||
[[30.6.8] [Function template async] [No] [async] [#4710]]
|
||||
[[30.6.8] [Class template packaged_task] [Partial] [-] [-]]
|
||||
]
|
||||
|
||||
[/
|
||||
|
||||
[table Extension
|
||||
[[Section] [Description] [Comments]]
|
||||
[[30.3.1.5.x] [interrupt] [-]]
|
||||
[[30.3.2.x] [Interruption] [-]]
|
||||
[[30.3.1.5.y] [operator==,operator!=] [-]]
|
||||
[[30.3.2.x] [Interruprion] [-]]
|
||||
[[30.3.2.y] [at_thread_exit] [-]]
|
||||
[[30.4.3.x] [Generic locking algorithms begin/end] [-]]
|
||||
[[30.x] [Barriers] [-]]
|
||||
[[30.y] [Thread Local Storage] [-]]
|
||||
[[30.z] [Class thread_group] [-]]
|
||||
]
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:shared Shared Mutex library extension]
|
||||
|
||||
[section:shared Shared Locking extensions]
|
||||
|
||||
[table Howard's Shared Locking Proposal Conformance
|
||||
[[Section] [Description] [Status] [Comments]]
|
||||
[[X] [Shared Locking] [Yes] [Needs `BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSION]]
|
||||
[[X.1] [Shared Lockables Concepts] [Yes] [ - ]]
|
||||
[[X.1.1] [SharedLockable concept] [Yes] [ - ]]
|
||||
[[X.1.2] [UpgradeLockable concept] [Yes] [ - ]]
|
||||
[[X.2] [Shared Mutex Types] [Yes] [ - ]]
|
||||
[[X.2.1] [shared_mutex class] [Yes] [ - ]]
|
||||
[[X.2.2] [upgrade_mutex class] [Yes] [ - ]]
|
||||
[[X.3] [Locks] [Yes] [-]]
|
||||
[[X.3.1] [unique_lock class adaptations] [Yes] [-]]
|
||||
[[X.3.2] [shared_lock class] [Yes] [ - ]]
|
||||
[[X.3.3] [upgrade_lock class] [Yes] [-]]
|
||||
[table Clock Requirements
|
||||
[[Section] [Description] [Status] [Comments]]
|
||||
[[XXXX] [DDDD] [SSSS] [CCCC]]
|
||||
[[XXXX] [DDDD] [SSSS] [CCCC]]
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
};
|
||||
class condition_variable;
|
||||
class condition_variable_any;
|
||||
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
}
|
||||
|
||||
The classes `condition_variable` and `condition_variable_any` provide a
|
||||
@@ -87,7 +86,7 @@ optimizations in some cases, based on the knowledge of the mutex type;
|
||||
|
||||
[section:condition_variable Class `condition_variable`]
|
||||
|
||||
//#include <boost/thread/condition_variable.hpp>
|
||||
#include <boost/thread/condition_variable.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -440,7 +439,7 @@ return true;
|
||||
|
||||
[section:condition_variable_any Class `condition_variable_any`]
|
||||
|
||||
//#include <boost/thread/condition_variable.hpp>
|
||||
#include <boost/thread/condition_variable.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -752,53 +751,14 @@ return true;
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:condition Typedef `condition` DEPRECATED V3]
|
||||
[section:condition Typedef `condition`]
|
||||
|
||||
// #include <boost/thread/condition.hpp>
|
||||
namespace boost
|
||||
{
|
||||
#include <boost/thread/condition.hpp>
|
||||
|
||||
typedef condition_variable_any condition;
|
||||
|
||||
}
|
||||
|
||||
The typedef `condition` is provided for backwards compatibility with previous boost releases.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
[section:notify_all_at_thread_exit Non-member Function `notify_all_at_thread_exit`()]
|
||||
|
||||
// #include <boost/thread/condition_variable.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
}
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Requires:] [`lk` is locked by the calling thread and either no other thread is waiting on `cond`, or `lk.mutex()` returns the same value for each of the lock arguments supplied by all concurrently waiting (via `wait`, `wait_for`, or `wait_until`) threads.]]
|
||||
[[Effects:] [transfers ownership of the lock associated with `lk` into internal storage and schedules `cond` to be notified when the current thread exits, after all objects of thread storage duration associated with the current thread have been destroyed. This notification shall be as if
|
||||
|
||||
``
|
||||
lk.unlock();
|
||||
cond.notify_all();
|
||||
``
|
||||
|
||||
]]
|
||||
|
||||
]
|
||||
|
||||
[/
|
||||
[[Synchronization:] [The call to notify_all_at_thread_exit and the completion of the destructors for all the current threadÕs variables of thread storage duration synchronize with (1.10) calls to functions waiting on cond.
|
||||
]]
|
||||
[[Note:] [The supplied lock will be held until the thread exits, and care must be taken to ensure that this does not cause deadlock due to lock ordering issues. After calling notify_all_at_thread_exit it is recommended that the thread should be exited as soon as possible, and that no blocking or time-consuming tasks are run on that thread.
|
||||
]]
|
||||
[[Note:] [It is the userÕs responsibility to ensure that waiting threads do not erroneously assume that the thread has finished if they experience spurious wakeups. This typically requires that the condition being waited for is satisfied while holding the lock on lk, and that this lock is not released and reacquired prior to calling notify_all_at_thread_exit.
|
||||
]]
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
|
||||
@@ -8,14 +8,20 @@
|
||||
|
||||
[section:configuration Configuration]
|
||||
|
||||
[section:system Boost.System]
|
||||
|
||||
Boost.Thread uses by default Boost.System to define the exceptions. For backward compatibility and also for compilers that don't work well with Boost.System the user can define `BOOST_THREAD_DONT_USE_SYSTEM `.
|
||||
|
||||
`BOOST_THREAD_USES_SYSTEM` is defined when Boost.Thread uses Boost.Move.
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:chrono Boost.Chrono]
|
||||
|
||||
Boost.Thread uses by default Boost.Chrono for the time related functions. For backward compatibility and also for compilers that don't work well with Boost.Chrono the user can define `BOOST_THREAD_DONT_USE_CHRONO`.
|
||||
Boost.Thread uses by default Boost.Chrono for the time related functions. For backward compatibility and also for compilers that don't work well with Boost.Chrono the user can define `BOOST_THREAD_DONT_USE_CHRONO`. If `BOOST_THREAD_DONT_USE_SYSTEM` is defined then `BOOST_THREAD_DONT_USE_CHRONO` is defined implicitly.
|
||||
|
||||
`BOOST_THREAD_USES_CHRONO` is defined when Boost.Thread uses Boost.Chrono.
|
||||
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:move Boost.Move]
|
||||
@@ -23,7 +29,7 @@ Boost.Thread uses by default Boost.Chrono for the time related functions. For ba
|
||||
Boost.Thread uses by default an internal move semantic implementation. Since version 3.0.0 you can use the move emulation emulation provided by Boost.Move.
|
||||
|
||||
When `BOOST_THREAD_VERSION==2` define `BOOST_THREAD_USES_MOVE ` if you want to use Boost.Move interface.
|
||||
When `BOOST_THREAD_VERSION==3` define `BOOST_THREAD_DONT_USE_MOVE ` if you don't want to use Boost.Move interface.
|
||||
When `BOOST_THREAD_VERSION==3` define `BOOST_THREAD_DONT_USE_MOVE ` if you want to use boost::unique_future.
|
||||
|
||||
[endsect]
|
||||
|
||||
@@ -38,7 +44,7 @@ When `BOOST_THREAD_VERSION==3` define `BOOST_THREAD_DONT_PROVIDE_GENERIC_SHARED_
|
||||
|
||||
[section:shared_upwards Shared Locking Upwards Conversion]
|
||||
|
||||
Boost.Threads includes in version 3 the Shared Locking Upwards Conversion as defined in [@http://home.roadrunner.com/~hinnant/bloomington/shared_mutex.html Shared Locking].
|
||||
Boost.Threads includes in version 2 the Shared Locking Upwards Conversion as defined in [@http://home.roadrunner.com/~hinnant/bloomington/shared_mutex.html Shared Locking].
|
||||
These conversions need to be used carefully to avoid deadlock or livelock. The user need to define explicitly `BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSION` to get these upwards conversions.
|
||||
|
||||
When `BOOST_THREAD_VERSION==2` define `BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSION ` if you want these features.
|
||||
@@ -161,12 +167,12 @@ These deprecated features will be provided by default up to boost 1.52. If you d
|
||||
[section:version Version]
|
||||
|
||||
`BOOST_THREAD_VERSION` defines the Boost.Thread version.
|
||||
The default version is 2. In this case the following breaking or extending macros are defined if the opposite is not requested:
|
||||
The default version is 1. In this case the following breaking or extending macros are defined if the opposite is not requested:
|
||||
|
||||
* `BOOST_THREAD_PROVIDES_PROMISE_LAZY`
|
||||
* `BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0`
|
||||
|
||||
The user can request the version 3 by defining `BOOST_THREAD_VERSION` to 3. In this case the following breaking or extending macros are defined if the opposite is not requested:
|
||||
The user can request the version 2 by defining `BOOST_THREAD_VERSION` to 2. In this case the following breaking or extending macros are defined if the opposite is not requested:
|
||||
|
||||
* Breaking change `BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION `
|
||||
* Breaking change `BOOST_THREAD_PROVIDES_FUTURE`
|
||||
@@ -180,8 +186,6 @@ The user can request the version 3 by defining `BOOST_THREAD_VERSION` to 3. In t
|
||||
* Breaking change `BOOST_THREAD_DONT_PROVIDE_PROMISE_LAZY`
|
||||
* Breaking change `BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0`
|
||||
|
||||
The default value for `BOOST_THREAD_VERSION` will be changed to 3 since Boost 1.53.
|
||||
|
||||
[endsect]
|
||||
|
||||
[endsect]
|
||||
@@ -195,16 +199,13 @@ Some compilers don't work correctly with some of the added features.
|
||||
If __SUNPRO_CC < 0x5100 the library defines
|
||||
|
||||
* `BOOST_THREAD_DONT_USE_MOVE`
|
||||
|
||||
If __SUNPRO_CC < 0x5100 the library defines
|
||||
|
||||
* `BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS`
|
||||
|
||||
|
||||
[endsect]
|
||||
[section:vacpp VACPP]
|
||||
|
||||
If __IBMCPP__ < 1100 the library defines
|
||||
If __IBMCPP__ is defined the library defines
|
||||
|
||||
* `BOOST_THREAD_DONT_USE_CHRONO`
|
||||
|
||||
|
||||
@@ -340,7 +340,7 @@ Instead of
|
||||
|
||||
use
|
||||
|
||||
switch (boost::native_value(ev))
|
||||
switch (BOOST_SCOPED_ENUM_NATIVE(future_errc)(ev))
|
||||
{
|
||||
case future_errc::broken_promise:
|
||||
|
||||
|
||||
@@ -5,17 +5,16 @@
|
||||
http://www.boost.org/LICENSE_1_0.txt).
|
||||
]
|
||||
|
||||
|
||||
[section:reference Futures Reference]
|
||||
|
||||
//#include <boost/thread/futures.hpp>
|
||||
|
||||
namespace boost
|
||||
namespace boost
|
||||
{
|
||||
#if defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0
|
||||
namespace future_state
|
||||
{
|
||||
enum state {uninitialized, waiting, ready, moved};
|
||||
enum state {uninitialized, waiting, ready, moved};
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -27,17 +26,6 @@
|
||||
no_state
|
||||
};
|
||||
|
||||
enum class launch
|
||||
{
|
||||
async = unspecified,
|
||||
deferred = unspecified,
|
||||
any = async | deferred
|
||||
};
|
||||
|
||||
enum class future_status {
|
||||
ready, timeout, deferred
|
||||
};
|
||||
|
||||
namespace system
|
||||
{
|
||||
template <>
|
||||
@@ -59,7 +47,7 @@
|
||||
void swap(promise<R>& x, promise<R>& y) noexcept;
|
||||
|
||||
namespace container {
|
||||
template <class R, class Alloc>
|
||||
template <class R, class Alloc>
|
||||
struct uses_allocator<promise<R>, Alloc>:: true_type;
|
||||
}
|
||||
|
||||
@@ -73,21 +61,14 @@
|
||||
class packaged_task;
|
||||
template <class R> void swap(packaged_task<R>&, packaged_task<R>&) noexcept;
|
||||
|
||||
template <class R, class Alloc>
|
||||
struct uses_allocator<packaged_task <R>, Alloc>;
|
||||
//template <class R, class Alloc>
|
||||
//struct uses_allocator<packaged_task <R>, Alloc>; // NOT YET IMPLEMENTED
|
||||
|
||||
template <class F>
|
||||
future<typename result_of<typename decay<F>::type()>::type>
|
||||
async(F f);
|
||||
template <class F>
|
||||
future<typename result_of<typename decay<F>::type()>::type>
|
||||
async(launch policy, F f);
|
||||
|
||||
// template <class F, class... Args>
|
||||
// future<typename result_of<typename decay<F>::type(typename decay<Args>::type...)>::type>
|
||||
// template <class F, class... Args>
|
||||
// future<typename result_of<typename decay<F>::type(typename decay<Args>::type...)>::type>
|
||||
// async(F&& f, Args&&... args); // NOT YET IMPLEMENTED
|
||||
// template <class F, class... Args>
|
||||
// future<typename result_of<typename decay<F>::type(typename decay<Args>::type...)>::type>
|
||||
// template <class F, class... Args>
|
||||
// future<typename result_of<typename decay<F>::type(typename decay<Args>::type...)>::type>
|
||||
// async(launch policy, F&& f, Args&&... args); // NOT YET IMPLEMENTED
|
||||
|
||||
|
||||
@@ -108,7 +89,7 @@
|
||||
|
||||
namespace future_state
|
||||
{
|
||||
enum state {uninitialized, waiting, ready, moved};
|
||||
enum state {uninitialized, waiting, ready, moved};
|
||||
}
|
||||
|
||||
|
||||
@@ -125,18 +106,6 @@
|
||||
no_state
|
||||
}
|
||||
|
||||
[endsect]
|
||||
[section:launch Enumeration `launch `]
|
||||
|
||||
enum class launch
|
||||
{
|
||||
async = unspecified,
|
||||
deferred = unspecified,
|
||||
any = async | deferred
|
||||
};
|
||||
|
||||
The enum type launch is a bitmask type with launch::async and launch::deferred denoting individual bits.
|
||||
|
||||
[endsect]
|
||||
[section:is_error_code_enum Specialization `is_error_code_enum<future_errc>`]
|
||||
|
||||
@@ -155,12 +124,6 @@ The enum type launch is a bitmask type with launch::async and launch::deferred d
|
||||
error_code make_error_code(future_errc e);
|
||||
}
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Returns:] [`error_code(static_cast<int>(e), future_category())`.]]
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
[section:make_error_condition Non-member function `make_error_condition()`]
|
||||
|
||||
@@ -169,26 +132,11 @@ The enum type launch is a bitmask type with launch::async and launch::deferred d
|
||||
error_condition make_error_condition(future_errc e);
|
||||
}
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Returns:] [`error_condition(static_cast<int>(e), future_category())`.]]
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
[section:future_category Non-member function `future_category()`]
|
||||
|
||||
const system::error_category& future_category();
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Returns:] [A reference to an object of a type derived from class error_category.]]
|
||||
|
||||
[[Notes:] [The object's `default_error_condition` and equivalent virtual functions behave as specified for the class `system::error_category`.
|
||||
The object's `name` virtual function returns a pointer to the string "future".]]
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
[section:future_error Class `future_error`]
|
||||
|
||||
@@ -201,98 +149,70 @@ The object's `name` virtual function returns a pointer to the string "future".]]
|
||||
const system::error_code& code() const no_except;
|
||||
};
|
||||
|
||||
[section:constructor Constructor]
|
||||
|
||||
future_error(system::error_code ec);
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [Constructs a future_error.]]
|
||||
|
||||
[[Postconditions:] [`code()==ec` ]]
|
||||
|
||||
[[Throws:] [Nothing.]]
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
[section:code Member function `code()`]
|
||||
|
||||
const system::error_code& code() const no_except;
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Returns:] [The value of `ec` that was passed to the object's constructor.]]
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:future_status Enumeration `future_status`]
|
||||
|
||||
enum class future_status {
|
||||
enum class future_status {
|
||||
ready, timeout, deferred
|
||||
};
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:unique_future __unique_future class template]
|
||||
[section:unique_future `unique_future` class template]
|
||||
|
||||
template <typename R>
|
||||
class __unique_future__
|
||||
class unique_future
|
||||
{
|
||||
|
||||
public:
|
||||
__unique_future__(__unique_future__ & rhs);// = delete;
|
||||
__unique_future__& operator=(__unique_future__& rhs);// = delete;
|
||||
unique_future(unique_future & rhs);// = delete;
|
||||
unique_future& operator=(unique_future& rhs);// = delete;
|
||||
|
||||
__unique_future__() noexcept;
|
||||
~__unique_future__();
|
||||
unique_future() noexcept;
|
||||
~unique_future();
|
||||
|
||||
// move support
|
||||
__unique_future__(__unique_future__ && other) noexcept;
|
||||
__unique_future__& operator=(__unique_future__ && other) noexcept;
|
||||
shared_future<R> share();
|
||||
// move support
|
||||
unique_future(unique_future && other) noexcept;
|
||||
unique_future& operator=(unique_future && other) noexcept;
|
||||
shared_future<R> share();
|
||||
|
||||
void swap(__unique_future__& other) noexcept; // EXTENSION
|
||||
void swap(unique_future& other) noexcept; // EXTENSION
|
||||
|
||||
// retrieving the value
|
||||
R&& get();
|
||||
// retrieving the value
|
||||
R&& get();
|
||||
|
||||
// functions to check state
|
||||
bool valid() const;
|
||||
bool is_ready() const; // EXTENSION
|
||||
bool has_exception() const; // EXTENSION
|
||||
bool has_value() const; // EXTENSION
|
||||
// functions to check state
|
||||
bool valid() const;
|
||||
bool is_ready() const; // EXTENSION
|
||||
bool has_exception() const; // EXTENSION
|
||||
bool has_value() const; // EXTENSION
|
||||
|
||||
// waiting for the result to be ready
|
||||
void wait() const;
|
||||
template <class Rep, class Period>
|
||||
future_status wait_for(const chrono::duration<Rep, Period>& rel_time) const;
|
||||
template <class Clock, class Duration>
|
||||
future_status wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
|
||||
// waiting for the result to be ready
|
||||
void wait() const;
|
||||
template <class Rep, class Period>
|
||||
future_status wait_for(const chrono::duration<Rep, Period>& rel_time) const;
|
||||
template <class Clock, class Duration>
|
||||
future_status wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
|
||||
|
||||
#if defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 || defined BOOST_THREAD_DONT_USE_CHRONO
|
||||
template<typename Duration>
|
||||
bool timed_wait(Duration const& rel_time) const;
|
||||
bool timed_wait_until(boost::system_time const& abs_time) const;
|
||||
template<typename Duration>
|
||||
bool timed_wait(Duration const& rel_time) const;
|
||||
bool timed_wait_until(boost::system_time const& abs_time) const;
|
||||
#endif
|
||||
#if defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0
|
||||
typedef future_state::state state;
|
||||
state get_state() const;
|
||||
typedef future_state::state state;
|
||||
state get_state() const;
|
||||
#endif
|
||||
};
|
||||
|
||||
[section:default_constructor Default Constructor]
|
||||
|
||||
__unique_future__();
|
||||
unique_future();
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [Constructs an uninitialized __unique_future__.]]
|
||||
[[Effects:] [Constructs an uninitialized future.]]
|
||||
|
||||
[[Postconditions:] [[unique_future_is_ready_link `this->is_ready`] returns `false`. [unique_future_get_state_link
|
||||
`this->get_state()`] returns __uninitialized__.]]
|
||||
@@ -305,7 +225,7 @@ The object's `name` virtual function returns a pointer to the string "future".]]
|
||||
|
||||
[section:destructor Destructor]
|
||||
|
||||
~__unique_future__();
|
||||
~unique_future();
|
||||
|
||||
[variablelist
|
||||
|
||||
@@ -319,11 +239,11 @@ The object's `name` virtual function returns a pointer to the string "future".]]
|
||||
|
||||
[section:move_constructor Move Constructor]
|
||||
|
||||
__unique_future__(__unique_future__ && other);
|
||||
unique_future(unique_future && other);
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [Constructs a new __unique_future__, and transfers ownership of the asynchronous result associated with `other` to `*this`.]]
|
||||
[[Effects:] [Constructs a new future, and transfers ownership of the asynchronous result associated with `other` to `*this`.]]
|
||||
|
||||
[[Postconditions:] [[unique_future_get_state_link `this->get_state()`] returns the value of `other->get_state()` prior to the
|
||||
call. `other->get_state()` returns __uninitialized__. If `other` was associated with an asynchronous result, that result is now
|
||||
@@ -339,7 +259,7 @@ associated with `*this`. `other` is not associated with any asynchronous result.
|
||||
|
||||
[section:move_assignment Move Assignment Operator]
|
||||
|
||||
__unique_future__& operator=(__unique_future__ && other);
|
||||
unique_future& operator=(unique_future && other);
|
||||
|
||||
[variablelist
|
||||
|
||||
@@ -360,7 +280,7 @@ result prior to the call, that result no longer has an associated __unique_futur
|
||||
|
||||
[section:swap Member function `swap()`]
|
||||
|
||||
void swap(__unique_future__ & other) no_except;
|
||||
void swap(unique_future & other) no_except;
|
||||
|
||||
[variablelist
|
||||
|
||||
@@ -381,8 +301,8 @@ associated with an asynchronous result, that result is now associated with `othe
|
||||
[section:get Member function `get()`]
|
||||
|
||||
R&& get();
|
||||
R& __unique_future__<R&>::get();
|
||||
void __unique_future__<void>::get();
|
||||
R& unique_future<R&>::get();
|
||||
void unique_future<void>::get();
|
||||
|
||||
[variablelist
|
||||
|
||||
@@ -480,96 +400,16 @@ associated with `*this` is not ready at the point of the call, and the current t
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:wait_for Member function `wait_for()`]
|
||||
|
||||
template <class Rep, class Period>
|
||||
future_status wait_for(const chrono::duration<Rep, Period>& rel_time) const;
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [If `*this` is associated with an asynchronous result, waits until the result is ready, or the time specified by
|
||||
`wait_duration` has elapsed. If the result is not ready on entry, and the result has a ['wait callback] set, that callback is
|
||||
invoked prior to waiting.]]
|
||||
|
||||
[[Returns:] [
|
||||
|
||||
- `future_status::deferred` if the shared state contains a deferred function. (Not implemented yet)
|
||||
|
||||
- `future_status::ready` if the shared state is ready.
|
||||
|
||||
- `future_status::timeout` if the function is returning because the relative timeout specified by `rel_time` has expired.
|
||||
|
||||
]]
|
||||
|
||||
[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result
|
||||
associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
|
||||
['wait callback] if such a callback is called.]]
|
||||
|
||||
[[Postconditions:] [If this call returned `true`, then [unique_future_is_ready_link `this->is_ready()`] returns `true` and
|
||||
[unique_future_get_state_link `this->get_state()`] returns __ready__.]]
|
||||
|
||||
[[Notes:] [`wait_for()` is an ['interruption point]. `Duration` must be a type that meets the Boost.DateTime time duration requirements.]]
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:wait_until Member function `wait_until()`]
|
||||
|
||||
template <class Clock, class Duration>
|
||||
future_status wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [If `*this` is associated with an asynchronous result, waits until the result is ready, or the time point specified by
|
||||
`wait_timeout` has passed. If the result is not ready on entry, and the result has a ['wait callback] set, that callback is invoked
|
||||
prior to waiting.]]
|
||||
|
||||
[[Returns:] [
|
||||
|
||||
- `future_status::deferred` if the shared state contains a deferred function. (Not implemented yet)
|
||||
|
||||
- `future_status::ready` if the shared state is ready.
|
||||
|
||||
- `future_status::timeout` if the function is returning because the absolute timeout specified by `absl_time` has reached.
|
||||
|
||||
]]
|
||||
|
||||
[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result
|
||||
associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
|
||||
['wait callback] if such a callback is called.]]
|
||||
|
||||
[[Postconditions:] [If this call returned `true`, then [unique_future_is_ready_link `this->is_ready()`] returns `true` and
|
||||
[unique_future_get_state_link `this->get_state()`] returns __ready__.]]
|
||||
|
||||
[[Notes:] [`wait_until()` is an ['interruption point].]]
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
[section:valid Member function `valid()`]
|
||||
|
||||
bool valid() const;
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Returns:] [`true` if `*this` is associated with an asynchronous result, `false`
|
||||
otherwise.]]
|
||||
|
||||
[[Throws:] [Nothing.]]
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
[section:is_ready Member function `is_ready()` EXTENSION]
|
||||
|
||||
bool is_ready() const;
|
||||
bool is_ready();
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Returns:] [`true` if `*this` is associated with an asynchronous result and that result is ready for retrieval, `false`
|
||||
[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set.]]
|
||||
|
||||
[[Returns:] [`true` if `*this` is associated with an asynchronous result, and that result is ready for retrieval, `false`
|
||||
otherwise.]]
|
||||
|
||||
[[Throws:] [Nothing.]]
|
||||
@@ -580,10 +420,12 @@ otherwise.]]
|
||||
|
||||
[section:has_value Member function `has_value()` EXTENSION]
|
||||
|
||||
bool has_value() const;
|
||||
bool has_value();
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set with a value rather than an exception.]]
|
||||
|
||||
[[Returns:] [`true` if `*this` is associated with an asynchronous result, that result is ready for retrieval, and the result is a
|
||||
stored value, `false` otherwise.]]
|
||||
|
||||
@@ -595,10 +437,12 @@ stored value, `false` otherwise.]]
|
||||
|
||||
[section:has_exception Member function `has_exception()` EXTENSION]
|
||||
|
||||
bool has_exception() const;
|
||||
bool has_exception();
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set with an exception rather than a value.]]
|
||||
|
||||
[[Returns:] [`true` if `*this` is associated with an asynchronous result, that result is ready for retrieval, and the result is a
|
||||
stored exception, `false` otherwise.]]
|
||||
|
||||
@@ -634,46 +478,46 @@ associated with `*this` is ready for retrieval, __waiting__ otherwise.]]
|
||||
class shared_future
|
||||
{
|
||||
public:
|
||||
typedef future_state::state state; // EXTENSION
|
||||
typedef future_state::state state; // EXTENSION
|
||||
|
||||
shared_future() noexcept;
|
||||
~shared_future();
|
||||
shared_future() noexcept;
|
||||
~shared_future();
|
||||
|
||||
// copy support
|
||||
shared_future(shared_future const& other);
|
||||
shared_future& operator=(shared_future const& other);
|
||||
// copy support
|
||||
shared_future(shared_future const& other);
|
||||
shared_future& operator=(shared_future const& other);
|
||||
|
||||
// move support
|
||||
shared_future(shared_future && other) noexcept;
|
||||
shared_future(__unique_future__<R> && other) noexcept;
|
||||
shared_future& operator=(shared_future && other) noexcept;
|
||||
shared_future& operator=(__unique_future__<R> && other) noexcept;
|
||||
// move support
|
||||
shared_future(shared_future && other) noexcept;
|
||||
shared_future(unique_future<R> && other) noexcept;
|
||||
shared_future& operator=(shared_future && other) noexcept;
|
||||
shared_future& operator=(unique_future<R> && other) noexcept;
|
||||
|
||||
void swap(shared_future& other);
|
||||
void swap(shared_future& other);
|
||||
|
||||
// retrieving the value
|
||||
R get();
|
||||
// retrieving the value
|
||||
R get();
|
||||
|
||||
// functions to check state, and wait for ready
|
||||
bool valid() const noexcept;
|
||||
bool is_ready() const noexcept; // EXTENSION
|
||||
bool has_exception() const noexcept; // EXTENSION
|
||||
bool has_value() const noexcept; // EXTENSION
|
||||
|
||||
// functions to check state, and wait for ready
|
||||
bool valid() const noexcept;
|
||||
bool is_ready() const noexcept; // EXTENSION
|
||||
bool has_exception() const noexcept; // EXTENSION
|
||||
bool has_value() const noexcept; // EXTENSION
|
||||
|
||||
// waiting for the result to be ready
|
||||
void wait() const;
|
||||
template <class Rep, class Period>
|
||||
future_status wait_for(const chrono::duration<Rep, Period>& rel_time) const;
|
||||
template <class Clock, class Duration>
|
||||
future_status wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
|
||||
// waiting for the result to be ready
|
||||
void wait() const;
|
||||
template <class Rep, class Period>
|
||||
future_status wait_for(const chrono::duration<Rep, Period>& rel_time) const;
|
||||
template <class Clock, class Duration>
|
||||
future_status wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
|
||||
|
||||
#if defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 || defined BOOST_THREAD_DONT_USE_CHRONO
|
||||
template<typename Duration>
|
||||
bool timed_wait(Duration const& rel_time) const;
|
||||
bool timed_wait_until(boost::system_time const& abs_time) const;
|
||||
template<typename Duration>
|
||||
bool timed_wait(Duration const& rel_time) const;
|
||||
bool timed_wait_until(boost::system_time const& abs_time) const;
|
||||
#endif
|
||||
#if defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0
|
||||
state get_state() const noexcept;
|
||||
state get_state() const noexcept;
|
||||
#endif
|
||||
};
|
||||
|
||||
@@ -683,7 +527,7 @@ associated with `*this` is ready for retrieval, __waiting__ otherwise.]]
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [Constructs an uninitialized shared_future.]]
|
||||
[[Effects:] [Constructs an uninitialized future.]]
|
||||
|
||||
[[Postconditions:] [[shared_future_is_ready_link `this->is_ready`] returns `false`. [shared_future_get_state_link
|
||||
`this->get_state()`] returns __uninitialized__.]]
|
||||
@@ -790,96 +634,14 @@ associated with `*this` is not ready at the point of the call, and the current t
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:wait_for Member function `wait_for()`]
|
||||
|
||||
template <class Rep, class Period>
|
||||
future_status wait_for(const chrono::duration<Rep, Period>& rel_time) const;
|
||||
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [If `*this` is associated with an asynchronous result, waits until the result is ready, or the time specified by
|
||||
`wait_duration` has elapsed. If the result is not ready on entry, and the result has a ['wait callback] set, that callback is
|
||||
invoked prior to waiting.]]
|
||||
|
||||
[[Returns:] [
|
||||
|
||||
- `future_status::deferred` if the shared state contains a deferred function. (Not implemented yet)
|
||||
|
||||
- `future_status::ready` if the shared state is ready.
|
||||
|
||||
- `future_status::timeout` if the function is returning because the relative timeout specified by `rel_time` has expired.
|
||||
|
||||
]]
|
||||
|
||||
[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result
|
||||
associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
|
||||
['wait callback] if such a callback is called.]]
|
||||
|
||||
[[Postconditions:] [If this call returned `true`, then [shared_future_is_ready_link `this->is_ready()`] returns `true` and
|
||||
[shared_future_get_state_link `this->get_state()`] returns __ready__.]]
|
||||
|
||||
[[Notes:] [`timed_wait()` is an ['interruption point]. `Duration` must be a type that meets the Boost.DateTime time duration requirements.]]
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:wait_until Member function `wait_until()`]
|
||||
|
||||
template <class Clock, class Duration>
|
||||
future_status wait_until(const chrono::time_point<Clock, Duration>& abs_time) const;
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [If `*this` is associated with an asynchronous result, waits until the result is ready, or the time point specified by
|
||||
`wait_timeout` has passed. If the result is not ready on entry, and the result has a ['wait callback] set, that callback is invoked
|
||||
prior to waiting.]]
|
||||
|
||||
[[Returns:] [
|
||||
|
||||
- `future_status::deferred` if the shared state contains a deferred function. (Not implemented yet)
|
||||
|
||||
- `future_status::ready` if the shared state is ready.
|
||||
|
||||
- `future_status::timeout` if the function is returning because the absolute timeout specified by `absl_time` has reached.
|
||||
|
||||
]]
|
||||
|
||||
[[Throws:] [__future_uninitialized__ if `*this` is not associated with an asynchronous result. __thread_interrupted__ if the result
|
||||
associated with `*this` is not ready at the point of the call, and the current thread is interrupted. Any exception thrown by the
|
||||
['wait callback] if such a callback is called.]]
|
||||
|
||||
[[Postconditions:] [If this call returned `true`, then [shared_future_is_ready_link `this->is_ready()`] returns `true` and
|
||||
[shared_future_get_state_link `this->get_state()`] returns __ready__.]]
|
||||
|
||||
[[Notes:] [`timed_wait()` is an ['interruption point].]]
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:valid Member function `valid()`]
|
||||
|
||||
bool valid() const;
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Returns:] [`true` if `*this` is associated with an asynchronous result, `false`
|
||||
otherwise.]]
|
||||
|
||||
[[Throws:] [Nothing.]]
|
||||
|
||||
]
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:is_ready Member function `is_ready()` EXTENSION]
|
||||
|
||||
bool is_ready() const;
|
||||
bool is_ready();
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set.]]
|
||||
|
||||
[[Returns:] [`true` if `*this` is associated with an asynchronous result, and that result is ready for retrieval, `false`
|
||||
otherwise.]]
|
||||
|
||||
@@ -891,10 +653,12 @@ otherwise.]]
|
||||
|
||||
[section:has_value Member function `has_value()` EXTENSION]
|
||||
|
||||
bool has_value() const;
|
||||
bool has_value();
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set with a value rather than an exception.]]
|
||||
|
||||
[[Returns:] [`true` if `*this` is associated with an asynchronous result, that result is ready for retrieval, and the result is a
|
||||
stored value, `false` otherwise.]]
|
||||
|
||||
@@ -906,10 +670,12 @@ stored value, `false` otherwise.]]
|
||||
|
||||
[section:has_exception Member function `has_exception()` EXTENSION]
|
||||
|
||||
bool has_exception() const;
|
||||
bool has_exception();
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set with an exception rather than a value.]]
|
||||
|
||||
[[Returns:] [`true` if `*this` is associated with an asynchronous result, that result is ready for retrieval, and the result is a
|
||||
stored exception, `false` otherwise.]]
|
||||
|
||||
@@ -946,33 +712,33 @@ associated with `*this` is ready for retrieval, __waiting__ otherwise.]]
|
||||
{
|
||||
public:
|
||||
|
||||
promise();
|
||||
template <class Allocator>
|
||||
promise(allocator_arg_t, Allocator a);
|
||||
promise & operator=(const promise & rhs);// = delete;
|
||||
promise(const promise & rhs);// = delete;
|
||||
~promise();
|
||||
promise();
|
||||
template <class Allocator>
|
||||
promise(allocator_arg_t, Allocator a);
|
||||
promise & operator=(const promise & rhs);// = delete;
|
||||
promise(const promise & rhs);// = delete;
|
||||
~promise();
|
||||
|
||||
// Move support
|
||||
promise(promise && rhs) noexcept;;
|
||||
promise & operator=(promise&& rhs) noexcept;;
|
||||
// Move support
|
||||
promise(promise && rhs) noexcept;;
|
||||
promise & operator=(promise&& rhs) noexcept;;
|
||||
|
||||
void swap(promise& other) noexcept;
|
||||
// Result retrieval
|
||||
unique_future<R> get_future();
|
||||
|
||||
void swap(promise& other) noexcept;
|
||||
// Result retrieval
|
||||
__unique_future__<R> get_future();
|
||||
// Set the value
|
||||
void set_value(R& r);
|
||||
void set_value(R&& r);
|
||||
void set_exception(boost::exception_ptr e);
|
||||
|
||||
// Set the value
|
||||
void set_value(R& r);
|
||||
void set_value(R&& r);
|
||||
void set_exception(boost::exception_ptr e);
|
||||
// setting the result with deferred notification
|
||||
// void set_value_at_thread_exit(const R& r); // NOT YET IMPLEMENTED
|
||||
// void set_value_at_thread_exit(see below); // NOT YET IMPLEMENTED
|
||||
// void set_exception_at_thread_exit(exception_ptr p); // NOT YET IMPLEMENTED
|
||||
|
||||
// setting the result with deferred notification
|
||||
// void set_value_at_thread_exit(const R& r); // NOT YET IMPLEMENTED
|
||||
// void set_value_at_thread_exit(see below); // NOT YET IMPLEMENTED
|
||||
// void set_exception_at_thread_exit(exception_ptr p); // NOT YET IMPLEMENTED
|
||||
|
||||
template<typename F>
|
||||
void set_wait_callback(F f); // EXTENSION
|
||||
template<typename F>
|
||||
void set_wait_callback(F f); // EXTENSION
|
||||
};
|
||||
|
||||
[section:default_constructor Default Constructor]
|
||||
@@ -991,8 +757,8 @@ associated with `*this` is ready for retrieval, __waiting__ otherwise.]]
|
||||
|
||||
[section:alloc_constructor Allocator Constructor]
|
||||
|
||||
template <class Allocator>
|
||||
promise(allocator_arg_t, Allocator a);
|
||||
template <class Allocator>
|
||||
promise(allocator_arg_t, Allocator a);
|
||||
|
||||
[variablelist
|
||||
|
||||
@@ -1060,7 +826,7 @@ associated with that task to ['ready] with a __broken_promise__ exception as the
|
||||
|
||||
[section:get_future Member Function `get_future()`]
|
||||
|
||||
__unique_future__<R> get_future();
|
||||
unique_future<R> get_future();
|
||||
|
||||
[variablelist
|
||||
|
||||
@@ -1147,43 +913,43 @@ or __shared_future__ associated with this result, and the result is not ['ready]
|
||||
class packaged_task
|
||||
{
|
||||
public:
|
||||
typedef R result_type;
|
||||
typedef R result_type;
|
||||
|
||||
packaged_task(packaged_task&);// = delete;
|
||||
packaged_task& operator=(packaged_task&);// = delete;
|
||||
packaged_task(packaged_task&);// = delete;
|
||||
packaged_task& operator=(packaged_task&);// = delete;
|
||||
|
||||
// construction and destruction
|
||||
packaged_task() noexcept;
|
||||
// construction and destruction
|
||||
packaged_task() noexcept;
|
||||
|
||||
explicit packaged_task(R(*f)());
|
||||
explicit packaged_task(R(*f)());
|
||||
|
||||
template <class F>
|
||||
explicit packaged_task(F&& f);
|
||||
|
||||
template <class F>
|
||||
explicit packaged_task(F&& f);
|
||||
template <class F, class Allocator>
|
||||
packaged_task(allocator_arg_t, Allocator a, F&& f);
|
||||
|
||||
template <class F, class Allocator>
|
||||
packaged_task(allocator_arg_t, Allocator a, F&& f);
|
||||
~packaged_task()
|
||||
{}
|
||||
|
||||
~packaged_task()
|
||||
{}
|
||||
// move support
|
||||
packaged_task(packaged_task&& other) noexcept;
|
||||
packaged_task& operator=(packaged_task&& other) noexcept;
|
||||
|
||||
// move support
|
||||
packaged_task(packaged_task&& other) noexcept;
|
||||
packaged_task& operator=(packaged_task&& other) noexcept;
|
||||
void swap(packaged_task& other) noexcept;
|
||||
|
||||
void swap(packaged_task& other) noexcept;
|
||||
bool valid() const noexcept;
|
||||
// result retrieval
|
||||
unique_future<R> get_future();
|
||||
|
||||
bool valid() const noexcept;
|
||||
// result retrieval
|
||||
__unique_future__<R> get_future();
|
||||
// execution
|
||||
void operator()();
|
||||
// void operator()(ArgTypes... ); // NOT YET IMPLEMENTED
|
||||
// void make_ready_at_thread_exit(ArgTypes...); // NOT YET IMPLEMENTED
|
||||
|
||||
// execution
|
||||
void operator()();
|
||||
// void operator()(ArgTypes... ); // NOT YET IMPLEMENTED
|
||||
// void make_ready_at_thread_exit(ArgTypes...); // NOT YET IMPLEMENTED
|
||||
|
||||
void reset();
|
||||
template<typename F>
|
||||
void set_wait_callback(F f); // EXTENSION
|
||||
void reset();
|
||||
template<typename F>
|
||||
void set_wait_callback(F f); // EXTENSION
|
||||
};
|
||||
|
||||
[section:task_constructor Task Constructor]
|
||||
@@ -1211,10 +977,10 @@ structures could not be allocated.]]
|
||||
|
||||
[section:alloc_constructor Allocator Constructor]
|
||||
|
||||
template <class Allocator>
|
||||
packaged_task(allocator_arg_t, Allocator a, R(*f)());
|
||||
template <class F, class Allocator>
|
||||
packaged_task(allocator_arg_t, Allocator a, F&& f);
|
||||
template <class Allocator>
|
||||
packaged_task(allocator_arg_t, Allocator a, R(*f)());
|
||||
template <class F, class Allocator>
|
||||
packaged_task(allocator_arg_t, Allocator a, F&& f);
|
||||
|
||||
[variablelist
|
||||
|
||||
@@ -1286,7 +1052,7 @@ associated with that task to ['ready] with a __broken_promise__ exception as the
|
||||
|
||||
[section:get_future Member Function `get_future()`]
|
||||
|
||||
__unique_future__<R> get_future();
|
||||
unique_future<R> get_future();
|
||||
|
||||
[variablelist
|
||||
|
||||
@@ -1320,7 +1086,7 @@ __packaged_task__. __task_already_started__ if the task has already been invoked
|
||||
|
||||
[section:reset Member Function `reset()`]
|
||||
|
||||
void reset();
|
||||
void reset();
|
||||
|
||||
[variablelist
|
||||
|
||||
@@ -1357,129 +1123,6 @@ __packaged_task__.]]
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
[section:decay_copy Non-member function `decay_copy()`]
|
||||
template <class T>
|
||||
typename decay<T>::type decay_copy(T&& v)
|
||||
{
|
||||
return boost::forward<T>(v);
|
||||
}
|
||||
|
||||
[endsect]
|
||||
|
||||
[section:async Non-member function `async()`]
|
||||
|
||||
template <class F>
|
||||
__unique_future__<typename result_of<typename decay<F>::type()>::type>
|
||||
async(F f);
|
||||
template <class F>
|
||||
__unique_future__<typename result_of<typename decay<F>::type()>::type>
|
||||
async(launch policy, F f);
|
||||
|
||||
|
||||
The function template async provides a mechanism to launch a function potentially in a new thread and
|
||||
provides the result of the function in a future object with which it shares a shared state.
|
||||
|
||||
[warning `async(launch::deferred, F)` is NOT YET IMPLEMENTED!]
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Requires:] [
|
||||
|
||||
``
|
||||
decay_copy(boost::forward<F>(f))()
|
||||
``
|
||||
|
||||
shall be a valid expression.
|
||||
]]
|
||||
|
||||
[[Effects] [The first function behaves the same as a call to the second function with a policy argument of
|
||||
`launch::async | launch::deferred` and the same arguments for `F`. The second function creates a shared state that is associated with the returned future object.
|
||||
|
||||
The further behavior of the second function depends on the policy argument as follows (if more than one of these conditions applies, the implementation may choose any of the corresponding policies):
|
||||
|
||||
- if `policy & launch::async` is non-zero - calls `decay_copy(boost::forward<F>(f))()` as if in a new thread of execution represented by a thread object with the calls to `decay_copy()` being evaluated in the thread that called `async`. Any return value is stored as the result in the shared state. Any exception propagated from the execution of `decay_copy(boost::forward<F>(f))()` is stored as the exceptional result in the shared state. The thread object is stored in the shared state and affects the behavior of any asynchronous return objects that reference that state.
|
||||
|
||||
- if `policy & launch::deferred` is non-zero - Stores `decay_copy(boost::forward<F>(f))` in the shared state. This copy of `f` constitute a deferred function. Invocation of the deferred function evaluates `boost::move(g)()` where `g` is the stored value of `decay_copy(boost::forward<F>(f))`. The shared state is not made ready until the function has completed. The first call to a non-timed waiting function on an asynchronous return object referring to this shared state shall invoke the deferred function in the thread that called the waiting function. Once evaluation of `boost::move(g)()` begins, the function is no longer considered deferred. (Note: If this policy is specified together with other policies, such as when using a policy value of `launch::async | launch::deferred`, implementations should defer invocation or the selection of the policy when no more concurrency can be effectively exploited.)
|
||||
|
||||
]]
|
||||
|
||||
[[Returns:] [An object of type `__unique_future__<typename result_of<typename decay<F>::type()>::type>` that refers to the shared state created by this call to `async`.]]
|
||||
|
||||
[[Synchronization:] [Regardless of the provided policy argument,
|
||||
|
||||
- the invocation of `async` synchronizes with the invocation of `f`. (Note: This statement applies even when the corresponding future object is moved to another thread.); and
|
||||
|
||||
- the completion of the function `f` is sequenced before the shared state is made ready. (Note: `f` might not be called at all, so its completion might never happen.)
|
||||
|
||||
If the implementation chooses the `launch::async` policy,
|
||||
|
||||
- a call to a waiting function on an asynchronous return object that shares the shared state created by this async call shall block until the associated thread has completed, as if joined;
|
||||
|
||||
- the associated thread completion synchronizes with the return from the first function that successfully detects the ready status of the shared state or with the return from the last function that releases the shared state, whichever happens first.
|
||||
]]
|
||||
|
||||
[[Throws:][`system_error` if policy is `launch::async` and the implementation is unable to start a new thread.
|
||||
]]
|
||||
|
||||
[[Error conditions:] [
|
||||
|
||||
- `resource_unavailable_try_again` - if policy is `launch::async` and the system is unable to start a new thread.
|
||||
|
||||
]]
|
||||
|
||||
[[Remarks:] [The first signature shall not participate in overload resolution if decay<F>::type is boost::launch.
|
||||
]]
|
||||
|
||||
]
|
||||
|
||||
[/
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Requires:] [F and each Ti in Args shall satisfy the MoveConstructible requirements. INVOKE (DECAY_- COPY (boost::forward<F>(f)), decay_copy (boost::forward<Args>(args))...) shall be a valid expression.
|
||||
|
||||
]]
|
||||
[[Effects:] [The first function behaves the same as a call to the second function with a policy argument of launch::async | launch::deferred and the same arguments for F and Args. The second function creates a shared state that is associated with the returned future object. The further behavior of the second function depends on the policy argument as follows (if more than one of these conditions applies, the implementation may choose any of the corresponding policies):
|
||||
- if policy & launch::async is non-zero - calls INVOKE (decay_copy (boost::forward<F>(f)), decay_copy (boost::forward<Args>(args))...) (20.8.2, 30.3.1.2) as if in a new thread of exe- cution represented by a thread object with the calls to decay_copy() being evaluated in the thread that called async. Any return value is stored as the result in the shared state. Any excep- tion propagated from the execution of INVOKE(decay_copy(boost::forward<F>(f)), DECAY_- COPY (boost::forward<Args>(args))...) is stored as the exceptional result in the shared state. The thread object is stored in the shared state and affects the behavior of any asynchronous return objects that reference that state.
|
||||
- if policy & launch::deferred is non-zero - Stores decay_copy (boost::forward<F>(f)) and decay_copy (boost::forward<Args>(args))... in the shared state. These copies of f and args constitute a deferred function. Invocation of the deferred function evaluates INVOKE (boost::move(g), boost::move(xyz)) where g is the stored value of decay_copy (boost::forward<F>(f)) and xyz is the stored copy of decay_copy (boost::forward<Args>(args)).... The shared state is not made ready until the function has completed. The first call to a non-timed waiting function (30.6.4) on an asynchronous return object referring to this shared state shall invoke the deferred func- tion in the thread that called the waiting function. Once evaluation of INVOKE (boost::move(g), boost::move(xyz)) begins, the function is no longer considered deferred.
|
||||
|
||||
]]
|
||||
|
||||
[[Note:] [If this policy is specified together with other policies, such as when using a policy value of launch::async | launch::deferred, implementations should defer invocation or the selection of the policy when no more concurrency can be effectively exploited.]]
|
||||
[[Returns:] [An object of type __unique_future__<typename result_of<typename decay<F>::type(typename de- cay<Args>::type...)>::type> that refers to the shared state created by this call to async.]]
|
||||
|
||||
[[Synchronization:] [Regardless of the provided policy argument,
|
||||
|
||||
- the invocation of async synchronizes with (1.10) the invocation of f. (Note: This statement applies even when the corresponding future object is moved to another thread.); and
|
||||
- the completion of the function f is sequenced before (1.10) the shared state is made ready. (Note: f might not be called at all, so its completion might never happen.)
|
||||
If the implementation chooses the launch::async policy,
|
||||
- a call to a waiting function on an asynchronous return object that shares the shared state created by this async call shall block until the associated thread has completed, as if joined;
|
||||
- the associated thread completion synchronizes with (1.10) the return from the first function that successfully detects the ready status of the shared state or with the return from the last function that releases the shared state, whichever happens first.
|
||||
|
||||
]]
|
||||
|
||||
[[Throws:] [system_error if policy is launch::async and the implementation is unable to start a new thread.
|
||||
]]
|
||||
|
||||
[[Error conditions:][
|
||||
|
||||
- resource_unavailable_try_again - if policy is launch::async and the system is unable to start a new thread.
|
||||
]]
|
||||
|
||||
[[Remarks:] [The first signature shall not participate in overload resolution if decay<F>::type is boost::launch.
|
||||
]]
|
||||
|
||||
]
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
[section:wait_for_any Non-member function `wait_for_any()`]
|
||||
|
||||
template<typename Iterator>
|
||||
|
||||
@@ -23,26 +23,25 @@
|
||||
|
||||
|
||||
[template unique_future_link[link_text] [link thread.synchronization.futures.reference.unique_future [link_text]]]
|
||||
[def __unique_future__ [unique_future_link `future`]]
|
||||
[def __unique_future `future`]
|
||||
[def __unique_future__ [unique_future_link `boost::unique_future`]]
|
||||
|
||||
[template unique_future_get_link[link_text] [link thread.synchronization.futures.reference.unique_future.get [link_text]]]
|
||||
[def __unique_future_get__ [unique_future_get_link `boost::future<R>::get()`]]
|
||||
[def __unique_future_get__ [unique_future_get_link `boost::unique_future<R>::get()`]]
|
||||
|
||||
[template unique_future_wait_link[link_text] [link thread.synchronization.futures.reference.unique_future.wait [link_text]]]
|
||||
[def __unique_future_wait__ [unique_future_wait_link `boost::future<R>::wait()`]]
|
||||
[def __unique_future_wait__ [unique_future_wait_link `boost::unique_future<R>::wait()`]]
|
||||
|
||||
[template unique_future_is_ready_link[link_text] [link thread.synchronization.futures.reference.unique_future.is_ready [link_text]]]
|
||||
[def __unique_future_is_ready__ [unique_future_is_ready_link `boost::future<R>::is_ready()`]]
|
||||
[def __unique_future_is_ready__ [unique_future_is_ready_link `boost::unique_future<R>::is_ready()`]]
|
||||
|
||||
[template unique_future_has_value_link[link_text] [link thread.synchronization.futures.reference.unique_future.has_value [link_text]]]
|
||||
[def __unique_future_has_value__ [unique_future_has_value_link `boost::future<R>::has_value()`]]
|
||||
[def __unique_future_has_value__ [unique_future_has_value_link `boost::unique_future<R>::has_value()`]]
|
||||
|
||||
[template unique_future_has_exception_link[link_text] [link thread.synchronization.futures.reference.unique_future.has_exception [link_text]]]
|
||||
[def __unique_future_has_exception__ [unique_future_has_exception_link `boost::future<R>::has_exception()`]]
|
||||
[def __unique_future_has_exception__ [unique_future_has_exception_link `boost::unique_future<R>::has_exception()`]]
|
||||
|
||||
[template unique_future_get_state_link[link_text] [link thread.synchronization.futures.reference.unique_future.get_state [link_text]]]
|
||||
[def __unique_future_get_state__ [unique_future_get_state_link `boost::future<R>::get_state()`]]
|
||||
[def __unique_future_get_state__ [unique_future_get_state_link `boost::unique_future<R>::get_state()`]]
|
||||
|
||||
[template shared_future_link[link_text] [link thread.synchronization.futures.reference.shared_future [link_text]]]
|
||||
[def __shared_future__ [shared_future_link `boost::shared_future`]]
|
||||
@@ -70,7 +69,6 @@
|
||||
|
||||
[template packaged_task_link[link_text] [link thread.synchronization.futures.reference.packaged_task [link_text]]]
|
||||
[def __packaged_task__ [packaged_task_link `boost::packaged_task`]]
|
||||
[def __packaged_task [packaged_task_link `boost::packaged_task`]]
|
||||
|
||||
[template wait_for_any_link[link_text] [link thread.synchronization.futures.reference.wait_for_any [link_text]]]
|
||||
[def __wait_for_any__ [wait_for_any_link `boost::wait_for_any()`]]
|
||||
@@ -116,7 +114,7 @@ place of the return value.
|
||||
}
|
||||
|
||||
boost::packaged_task<int> pt(calculate_the_answer_to_life_the_universe_and_everything);
|
||||
boost::__unique_future__<int> fi=pt.get_future();
|
||||
boost::unique_future<int> fi=pt.get_future();
|
||||
|
||||
boost::thread task(boost::move(pt)); // launch task on a thread
|
||||
|
||||
@@ -134,7 +132,7 @@ future. A promise can therefore be used where the value may come from more than
|
||||
produce multiple values.
|
||||
|
||||
boost::promise<int> pi;
|
||||
boost::__unique_future__<int> fi;
|
||||
boost::unique_future<int> fi;
|
||||
fi=pi.get_future();
|
||||
|
||||
pi.set_value(42);
|
||||
@@ -176,7 +174,7 @@ call to `f.get()` invokes the callback `invoke_lazy_task`, which runs the task t
|
||||
{
|
||||
boost::packaged_task<int> task(calculate_the_answer_to_life_the_universe_and_everything);
|
||||
task.set_wait_callback(invoke_lazy_task);
|
||||
boost::__unique_future__<int> f(task.get_future());
|
||||
boost::unique_future<int> f(task.get_future());
|
||||
|
||||
assert(f.get()==42);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ Lock ownership acquired through a call to __lock_ref__ must be released through
|
||||
[endsect]
|
||||
[section:lockable `Lockable` Concept]
|
||||
|
||||
A type `L` meets the __Lockable requirements if it meets the __BasicLockable requirements and the following expressions are well-formed and have the specified semantics (`m` denotes a value of type `L`):
|
||||
A type `L` meets the __Lockable requirements if it meets the __BasicLocable requirements and the following expressions are well-formed and have the specified semantics (`m` denotes a value of type `L`):
|
||||
|
||||
* `m.__try_lock()`
|
||||
|
||||
@@ -343,8 +343,7 @@ Ownership can also be ['downgraded] as well as ['upgraded]: exclusive ownership
|
||||
__upgrade_lockable_concept__ can be downgraded to upgradable ownership or shared ownership, and upgradable ownership can be
|
||||
downgraded to plain shared ownership.
|
||||
|
||||
A type `L` meets the __UpgradeLockable requirements if it meets the __SharedLockable
|
||||
requirements and the following expressions are well-formed and have the specified semantics.
|
||||
A type `L` meets the __SharedLockable requirements if it meets the __TimedLockable requirements and the following expressions are well-formed and have the specified semantics.
|
||||
|
||||
[*Variables:]
|
||||
|
||||
@@ -361,7 +360,7 @@ requirements and the following expressions are well-formed and have the specifie
|
||||
* `m.__try_lock_upgrade_until(abs_time)`
|
||||
* `m.__unlock_and_lock_shared()`
|
||||
* `m.__unlock_and_lock_upgrade();`
|
||||
* `m.__unlock_upgrade_and_lock();`
|
||||
* `m.__unlock_upgrade_and_lock();`]
|
||||
* `m.__try_unlock_upgrade_and_lock()`
|
||||
* `m.__try_unlock_upgrade_and_lock_for(rel_time)`
|
||||
* `m.__try_unlock_upgrade_and_lock_until(abs_time)`
|
||||
@@ -791,16 +790,14 @@ blocking.]]
|
||||
|
||||
[section:locks Lock Types]
|
||||
|
||||
//#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/locks.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
struct defer_lock_t {};
|
||||
struct try_to_lock_t {};
|
||||
struct adopt_lock_t {};
|
||||
constexpr defer_lock_t defer_lock;
|
||||
constexpr try_to_lock_t try_to_lock;
|
||||
constexpr adopt_lock_t adopt_lock;
|
||||
const defer_lock_t defer_lock;
|
||||
const try_to_lock_t try_to_lock;
|
||||
const adopt_lock_t adopt_lock;
|
||||
|
||||
template<typename Lockable>
|
||||
class lock_guard
|
||||
@@ -818,7 +815,6 @@ blocking.]]
|
||||
void swap(upgrade_lock <Mutex>& lhs, upgrade_lock <Mutex>& rhs);
|
||||
template <class Mutex>
|
||||
class upgrade_to_unique_lock;
|
||||
}
|
||||
|
||||
[section:lock_tags Lock option tags]
|
||||
|
||||
@@ -841,7 +837,7 @@ These tags are used in scoped locks constructors to specify a specific behavior.
|
||||
|
||||
[section:lock_guard Class template `lock_guard`]
|
||||
|
||||
//#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/locks.hpp>
|
||||
|
||||
template<typename Lockable>
|
||||
class lock_guard
|
||||
@@ -907,7 +903,7 @@ object passed to the constructor.]]
|
||||
|
||||
[section:unique_lock Class template `unique_lock`]
|
||||
|
||||
//#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/locks.hpp>
|
||||
|
||||
template<typename Lockable>
|
||||
class unique_lock
|
||||
@@ -1070,7 +1066,7 @@ returns `false`.]]
|
||||
|
||||
[[Requires:] [The supplied `Mutex` type must implement `__try_unlock_shared_and_lock()`.]]
|
||||
|
||||
[[Effects:] [Constructs an object of type __unique_lock. Let `pm` be the pointer to the mutex and `owns` the ownership state. Initializes `pm` with nullptr and `owns` with false.
|
||||
[[Effects:] [Constructs an object of type __unique_lock. Let `pm` be and `owns` the ownership state. Initializes `pm` with nullptr and `owns` with false.
|
||||
If `sl.__owns_lock()` returns `false`, sets `pm` to the return value of `sl.release()`.
|
||||
Else `sl.__owns_lock()` returns `true`, and in this case if `sl.mutex()->try_unlock_shared_and_lock()` returns `true`, sets `pm` to the value returned by `sl.release()` and sets `owns` to `true`.]]
|
||||
|
||||
@@ -1096,8 +1092,8 @@ Else `sl.__owns_lock()` returns `true`, and in this case if `sl.mutex()->try_unl
|
||||
[[Requires:] [The supplied `Mutex` type shall implement `__try_unlock_shared_and_lock_until(abs_time)`.]]
|
||||
|
||||
[[Effects:] [Constructs an object of type `__unique_lock`, initializing `pm` with `nullptr` and `owns` with `false`.
|
||||
If `sl.__owns_lock_shared_ref__()` returns `false`, sets `pm` to the return value of `sl.release()`.
|
||||
Else `sl.__owns_lock_shared_ref__()` returns `true`, and in this case if `sl.mutex()->__try_unlock_shared_and_lock_until(abs_time)` returns `true`, sets `pm` to the value returned by `sl.release()` and sets `owns` to `true`.]]
|
||||
If `sl.__owns_lock()` returns `false`, sets `pm` to the return value of `sl.__release()`.
|
||||
Else `sl.owns_lock()` returns `true`, and in this case if `sl.mutex()->__try_unlock_shared_and_lock_until(abs_time)` returns `true`, sets `pm` to the value returned by `sl.release()` and sets `owns` to `true`.]]
|
||||
|
||||
[[Note:] [If `sl.owns_lock()` returns `true` and `sl.mutex()-> __try_unlock_shared_and_lock_until(abs_time)` returns `false`, `sl` is not modified.]]
|
||||
|
||||
@@ -1120,7 +1116,7 @@ Else `sl.__owns_lock_shared_ref__()` returns `true`, and in this case if `sl.mut
|
||||
[[Requires:] [The supplied `Mutex` type shall implement `__try_unlock_shared_and_lock_for(rel_time)`.]]
|
||||
|
||||
[[Effects:] [Constructs an object of type `__unique_lock`, initializing `pm` with `nullptr` and `owns` with `false`.
|
||||
If `sl.__owns_lock()` returns `false`, sets `pm` to the return value of `sl.release()`.
|
||||
If `sl.__owns_lock()` returns `false`, sets `pm` to the return value of `sl.__release()`.
|
||||
Else `sl.owns_lock()` returns `true`, and in this case if `sl.mutex()-> __try_unlock_shared_and_lock_for(rel_time)` returns `true`, sets `pm` to the value returned by `sl.release()` and sets `owns` to `true`.]]
|
||||
|
||||
[[Note:] [If `sl.owns_lock()` returns `true` and `sl.mutex()-> __try_unlock_shared_and_lock_for(rel_time)` returns `false`, `sl` is not modified.]]
|
||||
@@ -1271,7 +1267,7 @@ __owns_lock_ref__ returns `false`.]]
|
||||
|
||||
[section:shared_lock Class template `shared_lock`]
|
||||
|
||||
//#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/locks.hpp>
|
||||
|
||||
template<typename Lockable>
|
||||
class shared_lock
|
||||
@@ -1512,7 +1508,7 @@ __owns_lock_shared_ref__ returns `false`.]]
|
||||
|
||||
[section:upgrade_lock Class template `upgrade_lock`]
|
||||
|
||||
//#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/locks.hpp>
|
||||
|
||||
template<typename Lockable>
|
||||
class upgrade_lock
|
||||
@@ -1667,10 +1663,8 @@ call [try_lock_ref_link `m.try_lock()`] rather than `m.lock()`.
|
||||
|
||||
[section: reverse_mutex Class template `reverse_mutex`]
|
||||
|
||||
//#include <boost/thread/reverse_mutex.hpp>
|
||||
#include <boost/thread/reverse_mutex.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<typename BasicLockable>
|
||||
class reverse_mutex
|
||||
{
|
||||
@@ -1685,7 +1679,6 @@ call [try_lock_ref_link `m.try_lock()`] rather than `m.lock()`.
|
||||
void lock();
|
||||
void unlock();
|
||||
};
|
||||
}
|
||||
|
||||
__reverse_mutex reverse the operations of a __BasicLockable, that unlocks the lockable when `lock()` is called and locks it when `unlock()` is called.
|
||||
|
||||
@@ -1699,29 +1692,24 @@ __reverse_mutex reverse the operations of a __BasicLockable, that unlocks the lo
|
||||
|
||||
[section:shared_lock_guard Class template `shared_lock_guard`]
|
||||
|
||||
// #include <boost/thread/shared_lock_guard.hpp>
|
||||
namespace boost
|
||||
{
|
||||
#include <boost/thread/shared_lock_guard.hpp>
|
||||
|
||||
template<typename SharedLockable>
|
||||
class shared_lock_guard
|
||||
{
|
||||
public:
|
||||
shared_lock_guard(shared_lock_guard const&) = delete;
|
||||
shared_lock_guard& operator=(shared_lock_guard const&) = delete;
|
||||
|
||||
explicit shared_lock_guard(SharedLockable& m_);
|
||||
shared_lock_guard(SharedLockable& m_,boost::adopt_lock_t);
|
||||
|
||||
~shared_lock_guard();
|
||||
};
|
||||
}
|
||||
|
||||
__shared_lock_guard is very simple: on construction it
|
||||
acquires shared ownership of the implementation of the __shared_lockable_concept__ supplied as
|
||||
the constructor parameter. On destruction, the ownership is released. This
|
||||
provides simple RAII-style locking of a __shared_lockable_concept_type__ object, to facilitate exception-safe
|
||||
shared locking and unlocking.
|
||||
In addition, the `__shared_lock_guard_constructor_adopt(SharedLockable &m, boost::adopt_lock_t)` constructor allows the __shared_lock_guard object to
|
||||
In addition, the `__shared_lock_guard_ca(SharedLockable &m, boost::adopt_lock_t)` constructor allows the __shared_lock_guard object to
|
||||
take shared ownership of a lock already held by the current thread.
|
||||
|
||||
[section:constructor `shared_lock_guard(SharedLockable & m)`]
|
||||
@@ -1768,9 +1756,7 @@ obtained by a call to `m.__lock_shared()`.]]
|
||||
|
||||
[section:reverse_lock Class template `reverse_lock`]
|
||||
|
||||
// #include <boost/thread/reverse_lock.hpp>
|
||||
namespace boost
|
||||
{
|
||||
#include <boost/thread/reverse_lock.hpp>
|
||||
|
||||
template<typename Lock>
|
||||
class reverse_lock
|
||||
@@ -1782,7 +1768,6 @@ obtained by a call to `m.__lock_shared()`.]]
|
||||
explicit reverse_lock(Lock& m_);
|
||||
~reverse_lock();
|
||||
};
|
||||
}
|
||||
|
||||
__reverse_lock reverse the operations of a lock: it provide for RAII-style, that unlocks the lock at construction time and lock it at destruction time. In addition, it transfer ownership temporarily, so that the mutex can not be locked using the Lock.
|
||||
|
||||
@@ -1792,9 +1777,9 @@ An instance of __reverse_lock doesn't ['own] the lock never.
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [Stores a reference to `m`. Invokes `m.__unlock()` if `m` owns his lock and then stores the mutex by calling `m.release()`.]]
|
||||
[[Effects:] [Stores a reference to `m`. Invokes `m.__unlock()` if `m` owns his lock and then stores the mutex by calling `m.__release()`.]]
|
||||
|
||||
[[Postcondition:] [`!m.__owns_lock() && m.mutex()==0`.]]
|
||||
[[Postcondition:] [`!m.__owns_lock() && m.__mutex()==0`.]]
|
||||
|
||||
[[Throws:] [Any exception thrown by the call to `m.__unlock()`.]]
|
||||
|
||||
@@ -1825,10 +1810,6 @@ An instance of __reverse_lock doesn't ['own] the lock never.
|
||||
|
||||
[section:lock_multiple Non-member function `lock(Lockable1,Lockable2,...)`]
|
||||
|
||||
// #include <boost/thread/locks.hpp>
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template<typename Lockable1,typename Lockable2>
|
||||
void lock(Lockable1& l1,Lockable2& l2);
|
||||
|
||||
@@ -1841,8 +1822,6 @@ An instance of __reverse_lock doesn't ['own] the lock never.
|
||||
template<typename Lockable1,typename Lockable2,typename Lockable3,typename Lockable4,typename Lockable5>
|
||||
void lock(Lockable1& l1,Lockable2& l2,Lockable3& l3,Lockable4& l4,Lockable5& l5);
|
||||
|
||||
}
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [Locks the __lockable_concept_type__ objects supplied as
|
||||
|
||||
@@ -131,7 +131,7 @@ implementation. If no such instance exists, `native_handle()` and `native_handle
|
||||
~recursive_mutex();
|
||||
|
||||
void lock();
|
||||
bool try_lock() noexcept;
|
||||
bool try_lock();
|
||||
void unlock();
|
||||
|
||||
typedef platform-specific-type native_handle_type;
|
||||
@@ -187,7 +187,7 @@ __recursive_try_mutex__ is a `typedef` to __recursive_mutex__, provided for back
|
||||
~recursive_timed_mutex();
|
||||
|
||||
void lock();
|
||||
bool try_lock() noexcept;
|
||||
bool try_lock();
|
||||
void unlock();
|
||||
|
||||
|
||||
|
||||
@@ -12,9 +12,7 @@ __boost_thread__ enables the use of multiple threads of execution with shared da
|
||||
functions for managing the threads themselves, along with others for synchronizing data between the threads or providing separate
|
||||
copies of data specific to individual threads.
|
||||
|
||||
The __boost_thread__ library was originally written and designed by William E. Kempf (version 1).
|
||||
|
||||
Anthony Williams version (version 2) was a major rewrite designed to
|
||||
The __boost_thread__ library was originally written and designed by William E. Kempf (version 0). Anthony Williams version (version 1) was a major rewrite designed to
|
||||
closely follow the proposals presented to the C++ Standards Committee, in particular
|
||||
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2497.html N2497],
|
||||
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2320.html N2320],
|
||||
@@ -22,8 +20,8 @@ closely follow the proposals presented to the C++ Standards Committee, in partic
|
||||
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2139.html N2139], and
|
||||
[@http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2094.html N2094]
|
||||
|
||||
Vicente J. Botet Escriba started (version 3) the adaptation to comply with the accepted Thread C++11 library (Make use of Boost.Chrono and Boost.Move) and the [@http://home.roadrunner.com/~hinnant/bloomington/shared_mutex.html Shared Locking] Howard Hinnant proposal except for the upward conversions.
|
||||
Some minor non-standard features have been added also as thread attributes, reverse_lock, shared_lock_guard.
|
||||
Vicente J. Botet Escriba started in version 2 the adaptation to comply with the accepted Thread C++11 library (Make use of Boost.Chrono and Boost.Move) and the [@http://home.roadrunner.com/~hinnant/bloomington/shared_mutex.html Shared Locking] Howard Hinnant proposal except for the upward conversions.
|
||||
Some minor features have been added also as thread attributes, reverse_lock, shared_lock_guard.
|
||||
|
||||
In order to use the classes and functions described here, you can
|
||||
either include the specific headers specified by the descriptions of
|
||||
@@ -44,27 +42,6 @@ The definition of these macros determines whether BOOST_THREAD_USE_DLL is define
|
||||
|
||||
The source code compiled when building the library defines a macros BOOST_THREAD_SOURCE that is used to import or export it. The user must not define this macro in any case.
|
||||
|
||||
Boost.Thread depends on some non header-only libraries.
|
||||
|
||||
* Boost.System: This dependency is mandatory and you will need to link with the library.
|
||||
|
||||
* Boost.Chrono: This dependency is optional (see below how to configure) and you will need to link with the library if you use some of the time related interfaces.
|
||||
|
||||
* Boost.DateTime: This dependency is mandatory, but even if Boost.DateTime is a non header-only library Boost.Thread uses only parts that are header-only, so in principle you should not need to link with the library.
|
||||
|
||||
It seems that there are some IDE (as e.g. Visual Studio) that deduce the libraries that a program needs to link to inspecting the sources. Such IDE could force to link to Boost.DateTime and/or Boost.Chrono.
|
||||
|
||||
As the single mandatory dependency is to Boost.System, the following
|
||||
|
||||
bjam toolset=msvc-11.0 --build-type=complete --with-thread
|
||||
|
||||
will install only boost_thread and boost_system.
|
||||
|
||||
Users of such IDE should force the Boost.Chrono and Boost.DateTime build using
|
||||
|
||||
bjam toolset=msvc-11.0 --build-type=complete --with-thread --with-chrono --with-date_time
|
||||
|
||||
|
||||
The following section describes all the macros used to configure Boost.Thread.
|
||||
|
||||
[include configuration.qbk]
|
||||
|
||||
@@ -58,7 +58,6 @@ __shared_lockable_concept__.
|
||||
Multiple concurrent calls to __lock_ref__, __try_lock_ref__, `__try_lock_for()`, `__try_lock_until()`, __timed_lock_ref__, __lock_shared_ref__,
|
||||
`__try_lock_shared_for()`, `__try_lock_shared_until()`, __try_lock_shared_ref__ and __timed_lock_shared_ref__ are permitted.
|
||||
|
||||
Note the the lack of reader-writer priority policies in shared_mutex. This is due to an algorithm credited to Alexander Terekhov which lets the OS decide which thread is the next to get the lock without caring whether a unique lock or shared lock is being sought. This results in a complete lack of reader or writer starvation. It is simply fair.
|
||||
|
||||
[endsect]
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
[library Thread
|
||||
[quickbook 1.5]
|
||||
[version 3.1.0]
|
||||
[version 3.0.0]
|
||||
[authors [Williams, Anthony] [Botet Escriba, Vicente J.]]
|
||||
[copyright 2007-11 Anthony Williams]
|
||||
[copyright 2011-12 Vicente J. Botet Escriba]
|
||||
@@ -135,7 +135,6 @@
|
||||
|
||||
[template owns_lock_ref_link[link_text] [link thread.synchronization.locks.unique_lock.owns_lock [link_text]]]
|
||||
[def __owns_lock_ref__ [owns_lock_ref_link `owns_lock()`]]
|
||||
[def __owns_lock [owns_lock_ref_link `owns_lock()`]]
|
||||
|
||||
[template owns_lock_shared_ref_link[link_text] [link thread.synchronization.locks.shared_lock.owns_lock [link_text]]]
|
||||
[def __owns_lock_shared_ref__ [owns_lock_shared_ref_link `owns_lock()`]]
|
||||
@@ -159,17 +158,15 @@
|
||||
|
||||
[def __lock_guard__ [link thread.synchronization.locks.lock_guard `boost::lock_guard`]]
|
||||
[def __unique_lock__ [unique_lock_link `boost::unique_lock`]]
|
||||
[def __unique_lock [unique_lock_link `boost::unique_lock`]]
|
||||
[def __shared_lock__ [link thread.synchronization.locks.shared_lock `boost::shared_lock`]]
|
||||
[def __upgrade_lock__ [link thread.synchronization.locks.upgrade_lock `boost::upgrade_lock`]]
|
||||
[def __upgrade_to_unique_lock__ [link thread.synchronization.locks.upgrade_to_unique_lock `boost::upgrade_to_unique_lock`]]
|
||||
[def __reverse_lock [link thread.synchronization.other_locks.reverse_lock `reverse_lock`]]
|
||||
[def __shared_lock_guard [link thread.synchronization.other_locks.shared_lock_guard `shared_lock_guard`]]
|
||||
[def __shared_lock_guard_constructor_adopt [link thread.synchronization.other_locks.shared_lock_guard `shared_lock_guard`]]
|
||||
|
||||
|
||||
[def __thread__ [link thread.thread_management.thread `boost::thread`]]
|
||||
[def __thread [link thread.thread_management.thread `thread`]]
|
||||
[def __thread [link thread.thread_management.thread `boost::thread`]]
|
||||
[def __thread_id__ [link thread.thread_management.thread.id `boost::thread::id`]]
|
||||
[template join_link[link_text] [link thread.thread_management.thread.join [link_text]]]
|
||||
[def __join__ [join_link `join()`]]
|
||||
|
||||
@@ -338,7 +338,7 @@ The user can access to some synchronization functions related to the native curr
|
||||
|
||||
Of course all the synchronization facilities provided by Boost.Thread are also available on native threads.
|
||||
|
||||
The `boost::this_thread` interrupt related functions behave in a degraded mode when called from a thread created using the native interface, i.e. `boost::this_thread::interruption_enabled()` returns false. As consequence the use of `boost::this_thread::disable_interruption` and `boost::this_thread::restore_interruption` will do nothing and calls to `boost::this_thread::interruption_point()` will be just ignored.
|
||||
The `boost::this_thread` interrupt related functions behave in a degraded mode when called from a thread created using the native interface, i.e. `boost::this_thread::interruption_enabled()` returns false. As consequence the use of `boost::this_thread::disable_interruption` and `boost::this_thread::restore_interruption` will do nothing and calls to `boost::this_thread::interrupt_point()` will be just ignored.
|
||||
|
||||
As the single way to interrupt a thread is through a __thread__ instance, `interruption_request()` wiil returns false for the native threads.
|
||||
|
||||
@@ -391,7 +391,7 @@ This behavior is incompatible with the current Boost.Thread design, so the use o
|
||||
void swap(thread& x) noexcept;
|
||||
|
||||
class id;
|
||||
class attributes; // EXTENSION
|
||||
class attributes;
|
||||
|
||||
id get_id() const noexcept;
|
||||
|
||||
@@ -470,8 +470,8 @@ This behavior is incompatible with the current Boost.Thread design, so the use o
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [Transfers ownership of the thread managed by `other` (if
|
||||
any) to `*this`. Version 2: If there was a thread previously associated with
|
||||
`*this` then that thread is detached, Version 3: If the thread is joinable calls to std::terminate.]]
|
||||
any) to `*this`. Version 1: If there was a thread previously associated with
|
||||
`*this` then that thread is detached, version 2: If the thread is joinable calls to std::terminate.]]
|
||||
|
||||
[[Postconditions:] [`other->get_id()==thread::id()` and `get_id()` returns the value of `other.get_id()` prior to the assignment.]]
|
||||
|
||||
@@ -628,7 +628,7 @@ are copied into internal storage for access by the new thread.]]]
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Effects:] [Version 2: If `*this` has an associated thread of execution, calls __detach__, Version 3: If the thread is joinable calls to std::terminate. Destroys `*this`.]]
|
||||
[[Effects:] [Version 1: If `*this` has an associated thread of execution, calls __detach__, Version 2: If the thread is joinable calls to std::terminate. Destroys `*this`.]]
|
||||
|
||||
[[Throws:] [Nothing.]]
|
||||
|
||||
@@ -686,14 +686,12 @@ are copied into internal storage for access by the new thread.]]]
|
||||
|
||||
[[Error Conditions:] [
|
||||
|
||||
[*resource_deadlock_would_occur]: if deadlock is detected or this->get_id() == boost::this_thread::get_id().
|
||||
|
||||
[*invalid_argument]: if the thread is not joinable and BOOST_THREAD_TRROW_IF_PRECONDITION_NOT_SATISFIED is defined.
|
||||
|
||||
[*resource_deadlock_would_occur]: if deadlock is detected or this->get_id() == std::this_thread::get_id().
|
||||
|
||||
[/
|
||||
[*no_such_process]: if the thread is not valid.
|
||||
|
||||
[*invalid_argument]: if the thread is not joinable.
|
||||
]
|
||||
|
||||
]]
|
||||
@@ -713,7 +711,7 @@ are copied into internal storage for access by the new thread.]]]
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Preconditions:] [the thread is joinable.]]
|
||||
[[Preconditions:] [`this->get_id()!=boost::this_thread::get_id()`]]
|
||||
|
||||
[[Effects:] [If `*this` refers to a thread of execution, waits for that thread of execution to complete, the time `wait_until` has
|
||||
been reach or the specified duration `rel_time` has elapsed. If `*this` doesn't refer to a thread of execution, returns immediately.]]
|
||||
@@ -729,13 +727,12 @@ unchanged.]]
|
||||
|
||||
[[Error Conditions:] [
|
||||
|
||||
[*resource_deadlock_would_occur]: if deadlock is detected or this->get_id() == boost::this_thread::get_id().
|
||||
|
||||
[*invalid_argument]: if the thread is not joinable and BOOST_THREAD_TRROW_IF_PRECONDITION_NOT_SATISFIED is defined.
|
||||
|
||||
[*resource_deadlock_would_occur]: if deadlock is detected or this->get_id() == std::this_thread::get_id().
|
||||
|
||||
[/
|
||||
[*no_such_process]: if the thread is not valid.
|
||||
|
||||
[*invalid_argument]: if the thread is not joinable.
|
||||
]
|
||||
|
||||
]]
|
||||
@@ -753,7 +750,7 @@ unchanged.]]
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Preconditions:] [the thread is joinable.]]
|
||||
[[Preconditions:] [`this->get_id()!=boost::this_thread::get_id()`]]
|
||||
|
||||
[[Effects:] [If `*this` refers to a thread of execution, waits for that thread of execution to complete,
|
||||
the specified duration `rel_time` has elapsed. If `*this` doesn't refer to a thread of execution, returns immediately.]]
|
||||
@@ -769,13 +766,12 @@ unchanged.]]
|
||||
|
||||
[[Error Conditions:] [
|
||||
|
||||
[*resource_deadlock_would_occur]: if deadlock is detected or this->get_id() == boost::this_thread::get_id().
|
||||
|
||||
[*invalid_argument]: if the thread is not joinable and BOOST_THREAD_TRROW_IF_PRECONDITION_NOT_SATISFIED is defined.
|
||||
|
||||
[*resource_deadlock_would_occur]: if deadlock is detected or this->get_id() == std::this_thread::get_id().
|
||||
|
||||
[/
|
||||
[*no_such_process]: if the thread is not valid.
|
||||
|
||||
[*invalid_argument]: if the thread is not joinable.
|
||||
]
|
||||
|
||||
]]
|
||||
@@ -793,7 +789,7 @@ unchanged.]]
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Preconditions:] [the thread is joinable.]]
|
||||
[[Preconditions:] [`this->get_id()!=boost::this_thread::get_id()`]]
|
||||
|
||||
[[Effects:] [If `*this` refers to a thread of execution, waits for that thread of execution to complete, the time `abs_time` has
|
||||
been reach. If `*this` doesn't refer to a thread of execution, returns immediately.]]
|
||||
@@ -809,14 +805,12 @@ unchanged.]]
|
||||
|
||||
[[Error Conditions:] [
|
||||
|
||||
[*resource_deadlock_would_occur]: if deadlock is detected or this->get_id() == boost::this_thread::get_id().
|
||||
|
||||
[*invalid_argument]: if the thread is not joinable and BOOST_THREAD_TRROW_IF_PRECONDITION_NOT_SATISFIED is defined.
|
||||
|
||||
[*resource_deadlock_would_occur]: if deadlock is detected or this->get_id() == std::this_thread::get_id().
|
||||
|
||||
[/
|
||||
[*no_such_process]: if the thread is not valid.
|
||||
|
||||
[*invalid_argument]: if the thread is not joinable.
|
||||
]
|
||||
|
||||
]]
|
||||
@@ -831,7 +825,7 @@ unchanged.]]
|
||||
|
||||
[section:detach Member function `detach()`]
|
||||
|
||||
void detach();
|
||||
void detach() noexcept;
|
||||
|
||||
[variablelist
|
||||
|
||||
@@ -841,15 +835,7 @@ unchanged.]]
|
||||
|
||||
[[Postconditions:] [`*this` no longer refers to any thread of execution.]]
|
||||
|
||||
[[Throws:] [`system_error`]]
|
||||
|
||||
[[Error Conditions:] [
|
||||
|
||||
[*no_such_process]: if the thread is not valid.
|
||||
|
||||
[*invalid_argument]: if the thread is not joinable and BOOST_THREAD_TRROW_IF_PRECONDITION_NOT_SATISFIED is defined.
|
||||
|
||||
]]
|
||||
[[Throws:] [Nothing]]
|
||||
|
||||
]
|
||||
|
||||
|
||||
18
doc/time.qbk
18
doc/time.qbk
@@ -10,16 +10,14 @@
|
||||
As of Boost 1.50.0, the __boost_thread__ library uses Boost.Chrono library for all operations that require a
|
||||
time out as defined in the standard c++11. These include (but are not limited to):
|
||||
|
||||
* `boost::this_thread::__sleep_for`
|
||||
* `boost::this_thread::__sleep_until`
|
||||
* `boost::__thread::__try_join_for`
|
||||
* `boost::__thread::__try_join_until`
|
||||
* `boost::__condition_variable::__wait_for`
|
||||
* `boost::__condition_variable::__wait_until`
|
||||
* `boost::__condition_variable_any::__cvany_wait_for`
|
||||
* `boost::__condition_variable_any::__cvany_wait_until`
|
||||
* `__TimedLockable::__try_lock_for`
|
||||
* `__TimedLockable::__try_lock_until`
|
||||
* __sleep_for
|
||||
* __sleep_until
|
||||
* __try_join_for
|
||||
* __try_join_until
|
||||
* __wait_for
|
||||
* __wait_until
|
||||
* __try_lock_for
|
||||
* __try_lock_until
|
||||
|
||||
[section:deprecated Deprecated]
|
||||
The time related functions introduced in Boost 1.35.0, using the [link date_time Boost.Date_Time] library are deprecated. These include (but are not limited to):
|
||||
|
||||
13
doc/tss.qbk
13
doc/tss.qbk
@@ -47,16 +47,10 @@ platforms such cleanup is only done for threads that are started with
|
||||
`boost::thread` unless `boost::on_thread_exit()` is called manually
|
||||
from that thread.
|
||||
|
||||
[heading Rationale about the nature of the key]
|
||||
|
||||
Boost.Thread uses the address of the `thread_specific_ptr` instance as key of the thread specific pointers. This avoids to create/destroy a key which will need a lock to protect from race conditions. This has a little performance liability, as the access must be done using an associative container.
|
||||
|
||||
[section:thread_specific_ptr Class `thread_specific_ptr`]
|
||||
|
||||
// #include <boost/thread/tss.hpp>
|
||||
#include <boost/thread/tss.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <typename T>
|
||||
class thread_specific_ptr
|
||||
{
|
||||
@@ -72,7 +66,6 @@ Boost.Thread uses the address of the `thread_specific_ptr` instance as key of th
|
||||
T* release();
|
||||
void reset(T* new_value=0);
|
||||
};
|
||||
}
|
||||
|
||||
[section:default_constructor `thread_specific_ptr();`]
|
||||
|
||||
@@ -109,14 +102,10 @@ supplied `cleanup_function` will be used to destroy any thread-local objects whe
|
||||
|
||||
[variablelist
|
||||
|
||||
[[Requires:] [All the thread specific instances associated to this thread_specific_ptr (except maybe the one associated to this thread) must be null.]]
|
||||
|
||||
[[Effects:] [Calls `this->reset()` to clean up the associated value for the current thread, and destroys `*this`.]]
|
||||
|
||||
[[Throws:] [Nothing.]]
|
||||
|
||||
[[Remarks:] [The requirement is due to the fact that in order to delete all these instances, the implementation should be forced to maintain a list of all the threads having an associated specific ptr, which is against the goal of thread specific data.]]
|
||||
|
||||
]
|
||||
|
||||
[note Care needs to be taken to ensure that any threads still running after an instance of `boost::thread_specific_ptr` has been
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/shared_mutex.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <vector>
|
||||
|
||||
#if defined BOOST_THREAD_USES_CHRONO
|
||||
#include <boost/chrono/chrono_io.hpp>
|
||||
|
||||
@@ -50,7 +50,7 @@ public:
|
||||
<< "very hot ..." << std::endl;
|
||||
}
|
||||
boost::xtime xt;
|
||||
boost::xtime_get(&xt, boost::TIME_UTC_);
|
||||
boost::xtime_get(&xt, boost::TIME_UTC);
|
||||
xt.sec += 3;
|
||||
boost::thread::sleep(xt);
|
||||
m_chickens += value;
|
||||
@@ -85,7 +85,7 @@ void chef()
|
||||
std::cout << "(" << clock() << ") Chef: cooking ..." << std::endl;
|
||||
}
|
||||
boost::xtime xt;
|
||||
boost::xtime_get(&xt, boost::TIME_UTC_);
|
||||
boost::xtime_get(&xt, boost::TIME_UTC);
|
||||
xt.sec += 2;
|
||||
boost::thread::sleep(xt);
|
||||
{
|
||||
@@ -111,7 +111,7 @@ struct phil
|
||||
if (m_id > 0)
|
||||
{
|
||||
boost::xtime xt;
|
||||
boost::xtime_get(&xt, boost::TIME_UTC_);
|
||||
boost::xtime_get(&xt, boost::TIME_UTC);
|
||||
xt.sec += 3;
|
||||
boost::thread::sleep(xt);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright (C) 2001-2003
|
||||
// William E. Kempf
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/thread/mutex.hpp>
|
||||
@@ -104,7 +104,7 @@ int main(int argc, char* argv[])
|
||||
boost::thread thrdb(thread_adapter(&player, (void*)PLAYER_B));
|
||||
|
||||
boost::xtime xt;
|
||||
boost::xtime_get(&xt, boost::TIME_UTC_);
|
||||
boost::xtime_get(&xt, boost::TIME_UTC);
|
||||
xt.sec += 1;
|
||||
boost::thread::sleep(xt);
|
||||
{
|
||||
|
||||
@@ -14,7 +14,7 @@ struct thread_alarm
|
||||
void operator()()
|
||||
{
|
||||
boost::xtime xt;
|
||||
boost::xtime_get(&xt, boost::TIME_UTC_);
|
||||
boost::xtime_get(&xt, boost::TIME_UTC);
|
||||
xt.sec += m_secs;
|
||||
|
||||
boost::thread::sleep(xt);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
int main()
|
||||
{
|
||||
boost::xtime xt;
|
||||
boost::xtime_get(&xt, boost::TIME_UTC_);
|
||||
boost::xtime_get(&xt, boost::TIME_UTC);
|
||||
xt.sec += 1;
|
||||
boost::thread::sleep(xt); // Sleep for 1 second
|
||||
}
|
||||
|
||||
@@ -8,40 +8,29 @@
|
||||
#ifndef BOOST_THREAD_CONFIG_WEK01032003_HPP
|
||||
#define BOOST_THREAD_CONFIG_WEK01032003_HPP
|
||||
|
||||
// Force SIG_ATOMIC_MAX to be defined
|
||||
//#ifndef __STDC_LIMIT_MACROS
|
||||
//#define __STDC_LIMIT_MACROS
|
||||
//#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#ifdef BOOST_NO_NOEXCEPT
|
||||
# define BOOST_THREAD_NOEXCEPT_OR_THROW throw()
|
||||
#else
|
||||
# define BOOST_THREAD_NOEXCEPT_OR_THROW noexcept
|
||||
#endif
|
||||
|
||||
// This compiler doesn't support Boost.Chrono
|
||||
#if defined __IBMCPP__ && (__IBMCPP__ < 1100) && ! defined BOOST_THREAD_DONT_USE_CHRONO
|
||||
#if defined __IBMCPP__ && (__IBMCPP__ < 1100)
|
||||
#define BOOST_THREAD_DONT_USE_CHRONO
|
||||
#endif
|
||||
|
||||
// This compiler doesn't support Boost.Move
|
||||
#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100) && ! defined BOOST_THREAD_DONT_USE_MOVE
|
||||
#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100)
|
||||
#define BOOST_THREAD_DONT_USE_MOVE
|
||||
#endif
|
||||
|
||||
// This compiler doesn't support Boost.Container Allocators files
|
||||
#if defined __SUNPRO_CC && ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS
|
||||
#if defined __SUNPRO_CC
|
||||
#define BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS
|
||||
#endif
|
||||
|
||||
#if defined _WIN32_WCE && _WIN32_WCE==0x501 && ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS
|
||||
#if defined _WIN32_WCE && _WIN32_WCE==0x501
|
||||
#define BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS
|
||||
#endif
|
||||
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_BASIC_THREAD_ID && ! defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_BASIC_THREAD_ID
|
||||
#define BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
|
||||
#endif
|
||||
|
||||
@@ -54,8 +43,13 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Uses Boost.Chrono by default if not stated the opposite defining BOOST_THREAD_DONT_USE_CHRONO
|
||||
#if ! defined BOOST_THREAD_DONT_USE_CHRONO && ! defined BOOST_THREAD_USES_CHRONO
|
||||
// Uses Boost.System by default if not stated the opposite defining BOOST_THREAD_DONT_USE_SYSTEM
|
||||
#if ! defined BOOST_THREAD_DONT_USE_SYSTEM
|
||||
#define BOOST_THREAD_USES_SYSTEM
|
||||
#endif
|
||||
|
||||
// Uses Boost.Chrono by default if not stated the opposite defining BOOST_THREAD_DONT_USE_CHRONO or BOOST_THREAD_DONT_USE_SYSTEM
|
||||
#if ! defined BOOST_THREAD_DONT_USE_CHRONO && ! defined BOOST_THREAD_DONT_USE_SYSTEM
|
||||
#define BOOST_THREAD_USES_CHRONO
|
||||
#endif
|
||||
|
||||
@@ -67,8 +61,15 @@
|
||||
#endif
|
||||
|
||||
|
||||
// Uses Boost.Move by default if not stated the opposite defining BOOST_THREAD_DONT_USE_MOVE
|
||||
#if ! defined BOOST_THREAD_DONT_USE_MOVE
|
||||
#if ! defined BOOST_THREAD_USES_MOVE
|
||||
//#define BOOST_THREAD_USES_MOVE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BOOST_THREAD_VERSION==2
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_PROMISE_LAZY && ! defined BOOST_THREAD_PROMISE_LAZY
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_PROMISE_LAZY
|
||||
#define BOOST_THREAD_PROMISE_LAZY
|
||||
#endif
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0
|
||||
@@ -77,59 +78,49 @@
|
||||
#endif
|
||||
|
||||
#if BOOST_THREAD_VERSION==3
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_ONCE_CXX11 \
|
||||
&& ! defined BOOST_THREAD_PROVIDES_ONCE_CXX11
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_ONCE_CXX11
|
||||
#define BOOST_THREAD_PROVIDES_ONCE_CXX11
|
||||
#endif
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE \
|
||||
&& ! defined BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE
|
||||
#define BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE
|
||||
#endif
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE \
|
||||
&& ! defined BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE
|
||||
#define BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE
|
||||
#endif
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE \
|
||||
&& ! defined BOOST_THREAD_PROVIDES_FUTURE
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE
|
||||
#define BOOST_THREAD_PROVIDES_FUTURE
|
||||
#endif
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS \
|
||||
&& ! defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS
|
||||
#define BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
|
||||
#endif
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_SHARED_MUTEX_UPWARDS_CONVERSIONS \
|
||||
&& ! defined BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_SHARED_MUTEX_UPWARDS_CONVERSIONS
|
||||
#define BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
|
||||
#endif
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_EXPLICIT_LOCK_CONVERSION \
|
||||
&& ! defined BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_EXPLICIT_LOCK_CONVERSION
|
||||
#define BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
|
||||
#endif
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_GENERIC_SHARED_MUTEX_ON_WIN \
|
||||
&& ! defined BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_GENERIC_SHARED_MUTEX_ON_WIN
|
||||
#define BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN
|
||||
#endif
|
||||
#if ! defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 \
|
||||
&& ! defined BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_
|
||||
#if ! defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0
|
||||
#define BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0
|
||||
#endif
|
||||
#if ! defined BOOST_THREAD_DONT_USE_MOVE \
|
||||
&& ! defined BOOST_THREAD_USES_MOVE
|
||||
#if ! defined BOOST_THREAD_DONT_USE_MOVE
|
||||
#if ! defined BOOST_THREAD_USES_MOVE
|
||||
#define BOOST_THREAD_USES_MOVE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
// BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN is defined if BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
|
||||
#if defined BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS \
|
||||
&& ! defined BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN
|
||||
#if defined BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
|
||||
#define BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN
|
||||
#endif
|
||||
|
||||
// BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 defined by default up to Boost 1.52
|
||||
// BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0 defined by default up to Boost 1.55
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0 \
|
||||
&& ! defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0
|
||||
#if ! defined BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0
|
||||
#define BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0
|
||||
#endif
|
||||
|
||||
@@ -140,11 +131,11 @@
|
||||
# pragma warn -8066 // Unreachable code
|
||||
#endif
|
||||
|
||||
#include <boost/thread/detail/platform.hpp>
|
||||
#include "platform.hpp"
|
||||
|
||||
// provided for backwards compatibility, since this
|
||||
// macro was used for several releases by mistake.
|
||||
#if defined(BOOST_THREAD_DYN_DLL) && ! defined BOOST_THREAD_DYN_LINK
|
||||
#if defined(BOOST_THREAD_DYN_DLL)
|
||||
# define BOOST_THREAD_DYN_LINK
|
||||
#endif
|
||||
|
||||
|
||||
@@ -8,21 +8,14 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
/**
|
||||
* BOOST_THREAD_DELETE_COPY_CTOR deletes the copy constructor when the compiler supports it or
|
||||
* makes it private.
|
||||
*
|
||||
* BOOST_THREAD_DELETE_COPY_ASSIGN deletes the copy assignment when the compiler supports it or
|
||||
* makes it private.
|
||||
*/
|
||||
#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#ifndef BOOST_NO_DELETED_FUNCTIONS
|
||||
#define BOOST_THREAD_DELETE_COPY_CTOR(CLASS) \
|
||||
CLASS(CLASS const&) = delete; \
|
||||
|
||||
#define BOOST_THREAD_DELETE_COPY_ASSIGN(CLASS) \
|
||||
CLASS& operator=(CLASS const&) = delete;
|
||||
|
||||
#else // BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#else // BOOST_NO_DELETED_FUNCTIONS
|
||||
#define BOOST_THREAD_DELETE_COPY_CTOR(CLASS) \
|
||||
private: \
|
||||
CLASS(CLASS&); \
|
||||
@@ -32,12 +25,8 @@
|
||||
private: \
|
||||
CLASS& operator=(CLASS&); \
|
||||
public:
|
||||
#endif // BOOST_NO_CXX11_DELETED_FUNCTIONS
|
||||
#endif // BOOST_NO_DELETED_FUNCTIONS
|
||||
|
||||
/**
|
||||
* BOOST_THREAD_NO_COPYABLE deletes the copy constructor and assignment when the compiler supports it or
|
||||
* makes them private.
|
||||
*/
|
||||
#define BOOST_THREAD_NO_COPYABLE(CLASS) \
|
||||
BOOST_THREAD_DELETE_COPY_CTOR(CLASS) \
|
||||
BOOST_THREAD_DELETE_COPY_ASSIGN(CLASS)
|
||||
|
||||
@@ -11,15 +11,9 @@
|
||||
#ifndef BOOST_THREAD_DETAIL_MEMORY_HPP
|
||||
#define BOOST_THREAD_DETAIL_MEMORY_HPP
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/container/allocator_traits.hpp>
|
||||
#include <boost/container/scoped_allocator.hpp>
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
#include <boost/type_traits/is_scalar.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@@ -33,7 +27,7 @@ namespace boost
|
||||
typedef typename alloc_traits::pointer pointer;
|
||||
typedef typename alloc_traits::size_type size_type;
|
||||
private:
|
||||
_Alloc alloc_;
|
||||
_Alloc& alloc_;
|
||||
size_type s_;
|
||||
public:
|
||||
allocator_destructor(_Alloc& a, size_type s)BOOST_NOEXCEPT
|
||||
@@ -41,115 +35,19 @@ namespace boost
|
||||
{}
|
||||
void operator()(pointer p)BOOST_NOEXCEPT
|
||||
{
|
||||
alloc_traits::destroy(alloc_, p);
|
||||
alloc_traits::deallocate(alloc_, p, s_);
|
||||
}
|
||||
};
|
||||
} //namespace thread_detail
|
||||
|
||||
typedef container::allocator_arg_t allocator_arg_t;
|
||||
BOOST_CONSTEXPR_OR_CONST allocator_arg_t allocator_arg = {};
|
||||
BOOST_CONSTEXPR allocator_arg_t allocator_arg = {};
|
||||
|
||||
template <class T, class Alloc>
|
||||
struct uses_allocator: public container::uses_allocator<T, Alloc>
|
||||
{
|
||||
};
|
||||
|
||||
template <class Ptr>
|
||||
struct pointer_traits
|
||||
{
|
||||
typedef Ptr pointer;
|
||||
// typedef <details> element_type;
|
||||
// typedef <details> difference_type;
|
||||
|
||||
// template <class U> using rebind = <details>;
|
||||
//
|
||||
// static pointer pointer_to(<details>);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct pointer_traits<T*>
|
||||
{
|
||||
typedef T* pointer;
|
||||
typedef T element_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
|
||||
// template <class U> using rebind = U*;
|
||||
//
|
||||
// static pointer pointer_to(<details>) noexcept;
|
||||
};
|
||||
|
||||
|
||||
namespace thread_detail {
|
||||
template <class _Ptr1, class _Ptr2,
|
||||
bool = is_same<typename remove_cv<typename pointer_traits<_Ptr1>::element_type>::type,
|
||||
typename remove_cv<typename pointer_traits<_Ptr2>::element_type>::type
|
||||
>::value
|
||||
>
|
||||
struct same_or_less_cv_qualified_imp
|
||||
: is_convertible<_Ptr1, _Ptr2> {};
|
||||
|
||||
template <class _Ptr1, class _Ptr2>
|
||||
struct same_or_less_cv_qualified_imp<_Ptr1, _Ptr2, false>
|
||||
: false_type {};
|
||||
|
||||
template <class _Ptr1, class _Ptr2, bool = is_scalar<_Ptr1>::value &&
|
||||
!is_pointer<_Ptr1>::value>
|
||||
struct same_or_less_cv_qualified
|
||||
: same_or_less_cv_qualified_imp<_Ptr1, _Ptr2> {};
|
||||
|
||||
template <class _Ptr1, class _Ptr2>
|
||||
struct same_or_less_cv_qualified<_Ptr1, _Ptr2, true>
|
||||
: false_type {};
|
||||
|
||||
}
|
||||
template <class T>
|
||||
struct BOOST_SYMBOL_VISIBLE default_delete
|
||||
{
|
||||
#ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
BOOST_SYMBOL_VISIBLE
|
||||
BOOST_CONSTEXPR default_delete() = default;
|
||||
#else
|
||||
BOOST_SYMBOL_VISIBLE
|
||||
BOOST_CONSTEXPR default_delete() BOOST_NOEXCEPT {}
|
||||
#endif
|
||||
template <class U>
|
||||
BOOST_SYMBOL_VISIBLE
|
||||
default_delete(const default_delete<U>&,
|
||||
typename enable_if<is_convertible<U*, T*> >::type* = 0) BOOST_NOEXCEPT {}
|
||||
BOOST_SYMBOL_VISIBLE
|
||||
void operator() (T* ptr) const BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_STATIC_ASSERT_MSG(sizeof(T) > 0, "default_delete can not delete incomplete type");
|
||||
delete ptr;
|
||||
}
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct BOOST_SYMBOL_VISIBLE default_delete<T[]>
|
||||
{
|
||||
public:
|
||||
#ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
|
||||
BOOST_SYMBOL_VISIBLE
|
||||
BOOST_CONSTEXPR default_delete() = default;
|
||||
#else
|
||||
BOOST_SYMBOL_VISIBLE
|
||||
BOOST_CONSTEXPR default_delete() BOOST_NOEXCEPT {}
|
||||
#endif
|
||||
template <class U>
|
||||
BOOST_SYMBOL_VISIBLE
|
||||
default_delete(const default_delete<U[]>&,
|
||||
typename enable_if<thread_detail::same_or_less_cv_qualified<U*, T*> >::type* = 0) BOOST_NOEXCEPT {}
|
||||
template <class U>
|
||||
BOOST_SYMBOL_VISIBLE
|
||||
void operator() (U* ptr,
|
||||
typename enable_if<thread_detail::same_or_less_cv_qualified<U*, T*> >::type* = 0) const BOOST_NOEXCEPT
|
||||
{
|
||||
BOOST_STATIC_ASSERT_MSG(sizeof(T) > 0, "default_delete can not delete incomplete type");
|
||||
delete [] ptr;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace boost
|
||||
}
|
||||
}
|
||||
|
||||
#if ! defined BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#if ! defined BOOST_NO_RVALUE_REFERENCES
|
||||
|
||||
#define BOOST_THREAD_RV_REF(TYPE) BOOST_RV_REF(TYPE)
|
||||
#define BOOST_THREAD_RV_REF_BEG BOOST_RV_REF_BEG
|
||||
@@ -84,7 +84,7 @@ namespace boost
|
||||
{}; \
|
||||
}
|
||||
|
||||
#elif ! defined BOOST_NO_CXX11_RVALUE_REFERENCES && defined BOOST_MSVC
|
||||
#elif ! defined BOOST_NO_RVALUE_REFERENCES && defined BOOST_MSVC
|
||||
|
||||
#define BOOST_THREAD_RV_REF(TYPE) BOOST_RV_REF(TYPE)
|
||||
#define BOOST_THREAD_RV_REF_BEG BOOST_RV_REF_BEG
|
||||
@@ -176,7 +176,7 @@ namespace detail
|
||||
#endif
|
||||
|
||||
|
||||
#if ! defined BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#if ! defined BOOST_NO_RVALUE_REFERENCES
|
||||
|
||||
#define BOOST_THREAD_MOVABLE(TYPE)
|
||||
|
||||
@@ -227,7 +227,7 @@ namespace detail
|
||||
|
||||
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
namespace boost
|
||||
{ namespace thread_detail
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
// choose platform
|
||||
#if defined(linux) || defined(__linux) || defined(__linux__)
|
||||
# define BOOST_THREAD_LINUX
|
||||
//# define BOOST_THREAD_WAIT_BUG boost::posix_time::microseconds(100000)
|
||||
# define BOOST_THREAD_WAIT_BUG boost::posix_time::microseconds(100000)
|
||||
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
|
||||
# define BOOST_THREAD_BSD
|
||||
#elif defined(sun) || defined(__sun)
|
||||
@@ -36,7 +36,7 @@
|
||||
# define BOOST_THREAD_BEOS
|
||||
#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
|
||||
# define BOOST_THREAD_MACOS
|
||||
//# define BOOST_THREAD_WAIT_BUG boost::posix_time::microseconds(1000)
|
||||
# define BOOST_THREAD_WAIT_BUG boost::posix_time::microseconds(1000)
|
||||
#elif defined(__IBMCPP__) || defined(_AIX)
|
||||
# define BOOST_THREAD_AIX
|
||||
#elif defined(__amigaos__)
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
#include <boost/bind.hpp>
|
||||
#include <stdlib.h>
|
||||
#include <memory>
|
||||
//#include <vector>
|
||||
//#include <utility>
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/remove_reference.hpp>
|
||||
#include <boost/io/ios_state.hpp>
|
||||
@@ -54,7 +52,7 @@ namespace boost
|
||||
{
|
||||
public:
|
||||
BOOST_THREAD_NO_COPYABLE(thread_data)
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
thread_data(BOOST_THREAD_RV_REF(F) f_):
|
||||
f(boost::forward<F>(f_))
|
||||
{}
|
||||
@@ -71,13 +69,10 @@ namespace boost
|
||||
f(f_)
|
||||
{}
|
||||
#endif
|
||||
//thread_data() {}
|
||||
|
||||
void run()
|
||||
{
|
||||
f();
|
||||
}
|
||||
|
||||
private:
|
||||
F f;
|
||||
};
|
||||
@@ -136,7 +131,7 @@ namespace boost
|
||||
|
||||
detail::thread_data_ptr get_thread_info BOOST_PREVENT_MACRO_SUBSTITUTION () const;
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template<typename F>
|
||||
static inline detail::thread_data_ptr make_thread_info(BOOST_THREAD_RV_REF(F) f)
|
||||
{
|
||||
@@ -179,7 +174,7 @@ namespace boost
|
||||
detach();
|
||||
#endif
|
||||
}
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template <
|
||||
class F
|
||||
>
|
||||
@@ -369,17 +364,11 @@ namespace boost
|
||||
#endif
|
||||
#if defined(BOOST_THREAD_PLATFORM_WIN32)
|
||||
bool timed_join(const system_time& abs_time);
|
||||
private:
|
||||
bool do_try_join_until(uintmax_t milli);
|
||||
public:
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
bool try_join_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>& tp)
|
||||
{
|
||||
chrono::milliseconds rel_time= chrono::ceil<chrono::milliseconds>(tp-chrono::system_clock::now());
|
||||
return do_try_join_until(rel_time.count());
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
bool try_join_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>& tp);
|
||||
#endif
|
||||
public:
|
||||
|
||||
#else
|
||||
bool timed_join(const system_time& abs_time)
|
||||
@@ -411,7 +400,7 @@ namespace boost
|
||||
return timed_join(get_system_time()+rel_time);
|
||||
}
|
||||
|
||||
void detach();
|
||||
void detach() BOOST_NOEXCEPT;
|
||||
|
||||
static unsigned hardware_concurrency() BOOST_NOEXCEPT;
|
||||
|
||||
@@ -445,7 +434,7 @@ namespace boost
|
||||
return lhs.swap(rhs);
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
inline thread&& move(thread& t) BOOST_NOEXCEPT
|
||||
{
|
||||
return static_cast<thread&&>(t);
|
||||
@@ -593,7 +582,6 @@ namespace boost
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0
|
||||
inline bool thread::operator==(const thread& other) const
|
||||
{
|
||||
return get_id()==other.get_id();
|
||||
@@ -603,7 +591,6 @@ namespace boost
|
||||
{
|
||||
return get_id()!=other.get_id();
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
@@ -9,12 +9,6 @@
|
||||
#define BOOST_THREAD_FUTURE_HPP
|
||||
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
|
||||
// boost::thread::future requires exception handling
|
||||
// due to boost::exception::exception_ptr dependency
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
|
||||
#include <boost/detail/scoped_enum_emulation.hpp>
|
||||
#include <stdexcept>
|
||||
#include <boost/thread/detail/move.hpp>
|
||||
@@ -49,16 +43,12 @@
|
||||
#include <boost/thread/detail/memory.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/utility/result_of.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
|
||||
#if defined BOOST_THREAD_PROVIDES_FUTURE
|
||||
#define BOOST_THREAD_FUTURE future
|
||||
#else
|
||||
#define BOOST_THREAD_FUTURE unique_future
|
||||
#endif
|
||||
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
@@ -77,7 +67,7 @@ namespace boost
|
||||
template <>
|
||||
struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc> : public true_type {};
|
||||
|
||||
#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
#ifdef BOOST_NO_SCOPED_ENUMS
|
||||
template <>
|
||||
struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc::enum_type> : public true_type { };
|
||||
#endif
|
||||
@@ -102,20 +92,20 @@ namespace boost
|
||||
BOOST_SCOPED_ENUM_DECLARE_END(future_status)
|
||||
|
||||
BOOST_THREAD_DECL
|
||||
const system::error_category& future_category() BOOST_NOEXCEPT;
|
||||
const system::error_category& future_category();
|
||||
|
||||
namespace system
|
||||
{
|
||||
inline
|
||||
inline BOOST_THREAD_DECL
|
||||
error_code
|
||||
make_error_code(future_errc e) //BOOST_NOEXCEPT
|
||||
make_error_code(future_errc e)
|
||||
{
|
||||
return error_code(underlying_cast<int>(e), boost::future_category());
|
||||
}
|
||||
|
||||
inline
|
||||
inline BOOST_THREAD_DECL
|
||||
error_condition
|
||||
make_error_condition(future_errc e) //BOOST_NOEXCEPT
|
||||
make_error_condition(future_errc e)
|
||||
{
|
||||
return error_condition(underlying_cast<int>(e), future_category());
|
||||
}
|
||||
@@ -136,18 +126,15 @@ namespace boost
|
||||
{
|
||||
return ec_;
|
||||
}
|
||||
const char* what() const BOOST_THREAD_NOEXCEPT_OR_THROW
|
||||
{
|
||||
return code().message().c_str();
|
||||
}
|
||||
|
||||
//virtual ~future_error() BOOST_NOEXCEPT;
|
||||
};
|
||||
|
||||
class BOOST_SYMBOL_VISIBLE future_uninitialized:
|
||||
public future_error
|
||||
{
|
||||
public:
|
||||
future_uninitialized() :
|
||||
future_uninitialized():
|
||||
future_error(system::make_error_code(future_errc::no_state))
|
||||
{}
|
||||
};
|
||||
@@ -182,6 +169,7 @@ namespace boost
|
||||
public:
|
||||
task_already_started():
|
||||
future_error(system::make_error_code(future_errc::promise_already_satisfied))
|
||||
//std::logic_error("Task already started")
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -191,6 +179,7 @@ namespace boost
|
||||
public:
|
||||
task_moved():
|
||||
future_error(system::make_error_code(future_errc::no_state))
|
||||
//std::logic_error("Task moved")
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -200,6 +189,7 @@ namespace boost
|
||||
public:
|
||||
promise_moved():
|
||||
future_error(system::make_error_code(future_errc::no_state))
|
||||
//std::logic_error("Promise moved")
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -374,7 +364,7 @@ namespace boost
|
||||
struct future_traits
|
||||
{
|
||||
typedef boost::scoped_ptr<T> storage_type;
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
typedef T const& source_reference_type;
|
||||
struct dummy;
|
||||
typedef typename boost::mpl::if_<boost::is_fundamental<T>,dummy&,BOOST_THREAD_RV_REF(T)>::type rvalue_source_type;
|
||||
@@ -484,7 +474,7 @@ namespace boost
|
||||
void mark_finished_with_result(rvalue_source_type result_)
|
||||
{
|
||||
boost::lock_guard<boost::mutex> lock(mutex);
|
||||
mark_finished_with_result_internal(static_cast<rvalue_source_type>(result_));
|
||||
mark_finished_with_result_internal(result_);
|
||||
}
|
||||
|
||||
move_dest_type get()
|
||||
@@ -576,7 +566,7 @@ namespace boost
|
||||
class future_waiter
|
||||
{
|
||||
struct registered_waiter;
|
||||
typedef std::vector<int>::size_type count_type;
|
||||
typedef std::vector<registered_waiter>::size_type count_type;
|
||||
|
||||
struct registered_waiter
|
||||
{
|
||||
@@ -594,20 +584,15 @@ namespace boost
|
||||
|
||||
struct all_futures_lock
|
||||
{
|
||||
#ifdef _MANAGED
|
||||
typedef std::ptrdiff_t count_type_portable;
|
||||
#else
|
||||
typedef count_type count_type_portable;
|
||||
#endif
|
||||
count_type_portable count;
|
||||
count_type count;
|
||||
boost::scoped_array<boost::unique_lock<boost::mutex> > locks;
|
||||
|
||||
all_futures_lock(std::vector<registered_waiter>& futures):
|
||||
count(futures.size()),locks(new boost::unique_lock<boost::mutex>[count])
|
||||
{
|
||||
for(count_type_portable i=0;i<count;++i)
|
||||
for(count_type i=0;i<count;++i)
|
||||
{
|
||||
#if defined __DECCXX || defined __SUNPRO_CC || defined __hpux
|
||||
#if defined __DECCXX || defined __SUNPRO_CC
|
||||
locks[i]=boost::unique_lock<boost::mutex>(futures[i].future_->mutex).move();
|
||||
#else
|
||||
locks[i]=boost::unique_lock<boost::mutex>(futures[i].future_->mutex);
|
||||
@@ -622,7 +607,7 @@ namespace boost
|
||||
|
||||
void unlock()
|
||||
{
|
||||
for(count_type_portable i=0;i<count;++i)
|
||||
for(count_type i=0;i<count;++i)
|
||||
{
|
||||
locks[i].unlock();
|
||||
}
|
||||
@@ -1224,11 +1209,6 @@ namespace boost
|
||||
future_->mark_exceptional_finish_internal(p);
|
||||
}
|
||||
|
||||
// setting the result with deferred notification
|
||||
//void set_value_at_thread_exit(const R& r); // NOT YET IMPLEMENTED
|
||||
//void set_value_at_thread_exit(see below); // NOT YET IMPLEMENTED
|
||||
//void set_exception_at_thread_exit(exception_ptr p); // NOT YET IMPLEMENTED
|
||||
|
||||
template<typename F>
|
||||
void set_wait_callback(F f)
|
||||
{
|
||||
@@ -1421,8 +1401,6 @@ namespace boost
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
template<typename R,typename F>
|
||||
struct task_object:
|
||||
task_base<R>
|
||||
@@ -1434,7 +1412,7 @@ namespace boost
|
||||
task_object(F const& f_):
|
||||
f(f_)
|
||||
{}
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
task_object(BOOST_THREAD_RV_REF(F) f_):
|
||||
f(boost::forward<F>(f_))
|
||||
{}
|
||||
@@ -1460,34 +1438,6 @@ namespace boost
|
||||
}
|
||||
};
|
||||
|
||||
template<typename R>
|
||||
struct task_object<R,R (*)()>:
|
||||
task_base<R>
|
||||
{
|
||||
private:
|
||||
task_object(task_object&);
|
||||
public:
|
||||
R (*f)();
|
||||
task_object(R (*f_)()):
|
||||
f(f_)
|
||||
{}
|
||||
void do_run()
|
||||
{
|
||||
try
|
||||
{
|
||||
this->mark_finished_with_result(f());
|
||||
}
|
||||
catch(thread_interrupted& )
|
||||
{
|
||||
this->mark_interrupted_finish();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
this->mark_exceptional_finish();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename F>
|
||||
struct task_object<void,F>:
|
||||
task_base<void>
|
||||
@@ -1499,7 +1449,7 @@ namespace boost
|
||||
task_object(F const& f_):
|
||||
f(f_)
|
||||
{}
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
task_object(BOOST_THREAD_RV_REF(F) f_):
|
||||
f(boost::forward<F>(f_))
|
||||
{}
|
||||
@@ -1527,35 +1477,6 @@ namespace boost
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct task_object<void,void (*)()>:
|
||||
task_base<void>
|
||||
{
|
||||
private:
|
||||
task_object(task_object&);
|
||||
public:
|
||||
void (*f)();
|
||||
task_object(void (*f_)()):
|
||||
f(f_)
|
||||
{}
|
||||
void do_run()
|
||||
{
|
||||
try
|
||||
{
|
||||
f();
|
||||
this->mark_finished_with_result();
|
||||
}
|
||||
catch(thread_interrupted& )
|
||||
{
|
||||
this->mark_interrupted_finish();
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
this->mark_exceptional_finish();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template<typename R>
|
||||
@@ -1578,7 +1499,7 @@ namespace boost
|
||||
explicit packaged_task(R(*f)()):
|
||||
task(new detail::task_object<R,R(*)()>(f)),future_obtained(false)
|
||||
{}
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template <class F>
|
||||
explicit packaged_task(BOOST_THREAD_RV_REF(F) f):
|
||||
task(new detail::task_object<R,
|
||||
@@ -1608,7 +1529,7 @@ namespace boost
|
||||
task = task_ptr(::new(a2.allocate(1)) detail::task_object<R,FR>(f), D(a2, 1) );
|
||||
future_obtained = false;
|
||||
}
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template <class F, class Allocator>
|
||||
packaged_task(boost::allocator_arg_t, Allocator a, BOOST_THREAD_RV_REF(F) f)
|
||||
{
|
||||
@@ -1641,7 +1562,7 @@ namespace boost
|
||||
task = task_ptr(::new(a2.allocate(1)) detail::task_object<R,F>(boost::move(f)), D(a2, 1) );
|
||||
future_obtained = false;
|
||||
}
|
||||
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#endif //BOOST_NO_RVALUE_REFERENCES
|
||||
#endif // BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
|
||||
|
||||
~packaged_task()
|
||||
@@ -1735,134 +1656,7 @@ namespace boost
|
||||
BOOST_THREAD_DCL_MOVABLE_BEG(T) packaged_task<T> BOOST_THREAD_DCL_MOVABLE_END
|
||||
|
||||
|
||||
template <class R>
|
||||
BOOST_THREAD_FUTURE<R>
|
||||
async(launch policy, R(*f)())
|
||||
{
|
||||
if (int(policy) & int(launch::async))
|
||||
{
|
||||
packaged_task<R> pt( f );
|
||||
|
||||
BOOST_THREAD_FUTURE<R> ret = pt.get_future();
|
||||
boost::thread( boost::move(pt) ).detach();
|
||||
return ::boost::move(ret);
|
||||
}
|
||||
else if (int(policy) & int(launch::deferred))
|
||||
{
|
||||
packaged_task<R> pt( f );
|
||||
|
||||
BOOST_THREAD_FUTURE<R> ret = pt.get_future();
|
||||
return ::boost::move(ret);
|
||||
} else {
|
||||
BOOST_THREAD_FUTURE<R> ret;
|
||||
return ::boost::move(ret);
|
||||
}
|
||||
}
|
||||
|
||||
template <class R>
|
||||
BOOST_THREAD_FUTURE<R>
|
||||
async(R(*f)())
|
||||
{
|
||||
return async(launch::any, f);
|
||||
}
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
template <class F>
|
||||
BOOST_THREAD_FUTURE<typename boost::result_of<typename decay<F>::type()>::type>
|
||||
async(launch policy, BOOST_THREAD_FWD_REF(F) f)
|
||||
{
|
||||
typedef typename boost::result_of<typename decay<F>::type()>::type R;
|
||||
if (int(policy) & int(launch::async))
|
||||
{
|
||||
packaged_task<R> pt( boost::forward<F>(f) );
|
||||
|
||||
BOOST_THREAD_FUTURE<R> ret = pt.get_future();
|
||||
boost::thread( boost::move(pt) ).detach();
|
||||
return ::boost::move(ret);
|
||||
}
|
||||
else if (int(policy) & int(launch::deferred))
|
||||
{
|
||||
packaged_task<R> pt( boost::forward<F>(f) );
|
||||
|
||||
BOOST_THREAD_FUTURE<R> ret = pt.get_future();
|
||||
return ::boost::move(ret);
|
||||
} else {
|
||||
BOOST_THREAD_FUTURE<R> ret;
|
||||
return ::boost::move(ret);
|
||||
}
|
||||
}
|
||||
template <class F>
|
||||
BOOST_THREAD_FUTURE<typename boost::result_of<F()>::type>
|
||||
async(BOOST_THREAD_RV_REF(F) f)
|
||||
{
|
||||
return async(launch::any, boost::forward<F>(f));
|
||||
}
|
||||
#else
|
||||
|
||||
// template <class F>
|
||||
// BOOST_THREAD_FUTURE<typename boost::result_of<typename decay<F>::type()>::type>
|
||||
// async(launch policy, F const& f)
|
||||
// {
|
||||
// typedef typename boost::result_of<typename decay<F>::type()>::type R;
|
||||
// if (int(policy) & int(launch::async))
|
||||
// {
|
||||
// packaged_task<R> pt( f );
|
||||
//
|
||||
// BOOST_THREAD_FUTURE<R> ret = pt.get_future();
|
||||
// boost::thread( boost::move(pt) ).detach();
|
||||
// return ::boost::move(ret);
|
||||
// }
|
||||
// else if (int(policy) & int(launch::deferred))
|
||||
// {
|
||||
// packaged_task<R> pt( f );
|
||||
//
|
||||
// BOOST_THREAD_FUTURE<R> ret = pt.get_future();
|
||||
// return ::boost::move(ret);
|
||||
// } else {
|
||||
// BOOST_THREAD_FUTURE<R> ret;
|
||||
// return ::boost::move(ret);
|
||||
// }
|
||||
// }
|
||||
// template <class F>
|
||||
// BOOST_THREAD_FUTURE<typename boost::result_of<F()>::type>
|
||||
// async(F const& f)
|
||||
// {
|
||||
// return async(launch::any, f);
|
||||
// }
|
||||
|
||||
template <class F>
|
||||
BOOST_THREAD_FUTURE<typename boost::result_of<typename decay<F>::type()>::type>
|
||||
async(launch policy, BOOST_THREAD_FWD_REF(F) f)
|
||||
{
|
||||
typedef typename boost::result_of<typename decay<F>::type()>::type R;
|
||||
if (int(policy) & int(launch::async))
|
||||
{
|
||||
packaged_task<R> pt( boost::forward<F>(f) );
|
||||
|
||||
BOOST_THREAD_FUTURE<R> ret = pt.get_future();
|
||||
boost::thread( boost::move(pt) ).detach();
|
||||
return ::boost::move(ret);
|
||||
}
|
||||
else if (int(policy) & int(launch::deferred))
|
||||
{
|
||||
packaged_task<R> pt( boost::forward<F>(f) );
|
||||
|
||||
BOOST_THREAD_FUTURE<R> ret = pt.get_future();
|
||||
return ::boost::move(ret);
|
||||
} else {
|
||||
BOOST_THREAD_FUTURE<R> ret;
|
||||
return ::boost::move(ret);
|
||||
}
|
||||
}
|
||||
template <class F>
|
||||
BOOST_THREAD_FUTURE<typename boost::result_of<F()>::type>
|
||||
async(BOOST_THREAD_FWD_REF(F) f)
|
||||
{
|
||||
return async(launch::any, boost::forward<F>(f));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif // BOOST_NO_EXCEPTION
|
||||
#endif // header
|
||||
|
||||
#endif
|
||||
|
||||
@@ -170,9 +170,9 @@ namespace boost
|
||||
struct adopt_lock_t
|
||||
{};
|
||||
|
||||
BOOST_CONSTEXPR_OR_CONST defer_lock_t defer_lock={};
|
||||
BOOST_CONSTEXPR_OR_CONST try_to_lock_t try_to_lock={};
|
||||
BOOST_CONSTEXPR_OR_CONST adopt_lock_t adopt_lock={};
|
||||
const defer_lock_t defer_lock={};
|
||||
const try_to_lock_t try_to_lock={};
|
||||
const adopt_lock_t adopt_lock={};
|
||||
|
||||
template<typename Mutex>
|
||||
class shared_lock;
|
||||
@@ -609,7 +609,7 @@ namespace boost
|
||||
is_locked=false;
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
|
||||
#if defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATORS)
|
||||
typedef void (unique_lock::*bool_type)();
|
||||
operator bool_type() const BOOST_NOEXCEPT
|
||||
{
|
||||
@@ -880,7 +880,7 @@ namespace boost
|
||||
is_locked=false;
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
|
||||
#if defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATORS)
|
||||
typedef void (shared_lock<Mutex>::*bool_type)();
|
||||
operator bool_type() const BOOST_NOEXCEPT
|
||||
{
|
||||
@@ -1140,7 +1140,7 @@ namespace boost
|
||||
return is_locked;
|
||||
}
|
||||
#endif
|
||||
#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
|
||||
#if defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATORS)
|
||||
typedef void (upgrade_lock::*bool_type)();
|
||||
operator bool_type() const BOOST_NOEXCEPT
|
||||
{
|
||||
@@ -1224,7 +1224,7 @@ namespace boost
|
||||
exclusive.swap(other.exclusive);
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
|
||||
#if defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATORS)
|
||||
typedef void (upgrade_to_unique_lock::*bool_type)(upgrade_to_unique_lock&);
|
||||
operator bool_type() const BOOST_NOEXCEPT
|
||||
{
|
||||
@@ -1275,7 +1275,7 @@ namespace boost
|
||||
try_lock_wrapper(Mutex& m_,try_to_lock_t):
|
||||
base(m_,try_to_lock)
|
||||
{}
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
try_lock_wrapper(BOOST_THREAD_RV_REF(try_lock_wrapper) other):
|
||||
base(::boost::move(other))
|
||||
{}
|
||||
@@ -1325,7 +1325,7 @@ namespace boost
|
||||
return base::release();
|
||||
}
|
||||
|
||||
#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS)
|
||||
#if defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATORS)
|
||||
typedef typename base::bool_type bool_type;
|
||||
operator bool_type() const
|
||||
{
|
||||
|
||||
@@ -229,11 +229,8 @@ namespace boost
|
||||
unique_lock<mutex>& lock,
|
||||
struct timespec const &timeout);
|
||||
};
|
||||
|
||||
BOOST_THREAD_DECL void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
}
|
||||
|
||||
|
||||
#include <boost/config/abi_suffix.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
@@ -12,34 +12,19 @@
|
||||
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
|
||||
#include <boost/thread/pthread/pthread_mutex_scoped_lock.hpp>
|
||||
#include <boost/thread/detail/delete.hpp>
|
||||
#include <boost/detail/no_exceptions_support.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config/abi_prefix.hpp>
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <pthread.h>
|
||||
#include <csignal>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/thread/pthread/pthread_mutex_scoped_lock.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/thread/detail/delete.hpp>
|
||||
|
||||
#include <boost/config/abi_prefix.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
#define BOOST_ONCE_INITIAL_FLAG_VALUE 0
|
||||
|
||||
namespace thread_detail
|
||||
{
|
||||
//#ifdef SIG_ATOMIC_MAX
|
||||
// typedef sig_atomic_t uintmax_atomic_t;
|
||||
// #define BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_MAX_C SIG_ATOMIC_MAX
|
||||
//#else
|
||||
typedef unsigned long uintmax_atomic_t;
|
||||
#define BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_C2(value) value##ul
|
||||
#define BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_MAX_C BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_C2(~0)
|
||||
//#endif
|
||||
}
|
||||
|
||||
#ifdef BOOST_THREAD_PROVIDES_ONCE_CXX11
|
||||
|
||||
struct once_flag
|
||||
@@ -49,7 +34,7 @@ namespace boost
|
||||
: epoch(BOOST_ONCE_INITIAL_FLAG_VALUE)
|
||||
{}
|
||||
private:
|
||||
volatile thread_detail::uintmax_atomic_t epoch;
|
||||
boost::uintmax_t epoch;
|
||||
template<typename Function>
|
||||
friend
|
||||
void call_once(once_flag& flag,Function f);
|
||||
@@ -59,7 +44,7 @@ namespace boost
|
||||
|
||||
struct once_flag
|
||||
{
|
||||
volatile thread_detail::uintmax_atomic_t epoch;
|
||||
boost::uintmax_t epoch;
|
||||
};
|
||||
|
||||
#define BOOST_ONCE_INIT {BOOST_ONCE_INITIAL_FLAG_VALUE}
|
||||
@@ -67,8 +52,8 @@ namespace boost
|
||||
|
||||
namespace detail
|
||||
{
|
||||
BOOST_THREAD_DECL thread_detail::uintmax_atomic_t& get_once_per_thread_epoch();
|
||||
BOOST_THREAD_DECL extern thread_detail::uintmax_atomic_t once_global_epoch;
|
||||
BOOST_THREAD_DECL boost::uintmax_t& get_once_per_thread_epoch();
|
||||
BOOST_THREAD_DECL extern boost::uintmax_t once_global_epoch;
|
||||
BOOST_THREAD_DECL extern pthread_mutex_t once_epoch_mutex;
|
||||
BOOST_THREAD_DECL extern pthread_cond_t once_epoch_cv;
|
||||
}
|
||||
@@ -78,10 +63,10 @@ namespace boost
|
||||
template<typename Function>
|
||||
void call_once(once_flag& flag,Function f)
|
||||
{
|
||||
static thread_detail::uintmax_atomic_t const uninitialized_flag=BOOST_ONCE_INITIAL_FLAG_VALUE;
|
||||
static thread_detail::uintmax_atomic_t const being_initialized=uninitialized_flag+1;
|
||||
thread_detail::uintmax_atomic_t const epoch=flag.epoch;
|
||||
thread_detail::uintmax_atomic_t& this_thread_epoch=detail::get_once_per_thread_epoch();
|
||||
static boost::uintmax_t const uninitialized_flag=BOOST_ONCE_INITIAL_FLAG_VALUE;
|
||||
static boost::uintmax_t const being_initialized=uninitialized_flag+1;
|
||||
boost::uintmax_t const epoch=flag.epoch;
|
||||
boost::uintmax_t& this_thread_epoch=detail::get_once_per_thread_epoch();
|
||||
|
||||
if(epoch<this_thread_epoch)
|
||||
{
|
||||
@@ -92,18 +77,21 @@ namespace boost
|
||||
if(flag.epoch==uninitialized_flag)
|
||||
{
|
||||
flag.epoch=being_initialized;
|
||||
BOOST_TRY
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
pthread::pthread_mutex_scoped_unlock relocker(&detail::once_epoch_mutex);
|
||||
f();
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
BOOST_CATCH (...)
|
||||
catch(...)
|
||||
{
|
||||
flag.epoch=uninitialized_flag;
|
||||
BOOST_VERIFY(!pthread_cond_broadcast(&detail::once_epoch_cv));
|
||||
BOOST_RETHROW
|
||||
throw;
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
#endif
|
||||
flag.epoch=--detail::once_global_epoch;
|
||||
BOOST_VERIFY(!pthread_cond_broadcast(&detail::once_epoch_cv));
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace boost
|
||||
BOOST_VERIFY(!pthread_mutex_unlock(&m));
|
||||
}
|
||||
|
||||
bool try_lock() BOOST_NOEXCEPT
|
||||
bool try_lock()
|
||||
{
|
||||
int const res=pthread_mutex_trylock(&m);
|
||||
BOOST_ASSERT(!res || res==EBUSY);
|
||||
@@ -294,7 +294,7 @@ namespace boost
|
||||
BOOST_VERIFY(!pthread_cond_signal(&cond));
|
||||
}
|
||||
|
||||
bool try_lock() BOOST_NOEXCEPT
|
||||
bool try_lock()
|
||||
{
|
||||
boost::pthread::pthread_mutex_scoped_lock const local_lock(&m);
|
||||
if(is_locked && !pthread_equal(owner,pthread_self()))
|
||||
|
||||
@@ -8,25 +8,18 @@
|
||||
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
#include <boost/thread/exceptions.hpp>
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/pthread/condition_variable_fwd.hpp>
|
||||
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <pthread.h>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/thread/pthread/condition_variable_fwd.hpp>
|
||||
#include <map>
|
||||
#include <unistd.h>
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
#include <boost/chrono/system_clocks.hpp>
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <boost/config/abi_prefix.hpp>
|
||||
|
||||
namespace boost
|
||||
@@ -111,28 +104,19 @@ namespace boost
|
||||
bool interrupt_requested;
|
||||
pthread_mutex_t* cond_mutex;
|
||||
pthread_cond_t* current_cond;
|
||||
typedef std::vector<std::pair<condition_variable*, mutex*>
|
||||
//, hidden_allocator<std::pair<condition_variable*, mutex*> >
|
||||
> notify_list_t;
|
||||
notify_list_t notify;
|
||||
|
||||
thread_data_base():
|
||||
done(false),join_started(false),joined(false),
|
||||
thread_exit_callbacks(0),
|
||||
interrupt_enabled(true),
|
||||
interrupt_requested(false),
|
||||
current_cond(0),
|
||||
notify()
|
||||
current_cond(0)
|
||||
{}
|
||||
virtual ~thread_data_base();
|
||||
|
||||
typedef pthread_t native_handle_type;
|
||||
|
||||
virtual void run()=0;
|
||||
void notify_all_at_thread_exit(condition_variable* cv, mutex* m)
|
||||
{
|
||||
notify.push_back(std::pair<condition_variable*, mutex*>(cv, m));
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_THREAD_DECL thread_data_base* get_current_thread_data();
|
||||
@@ -145,13 +129,11 @@ namespace boost
|
||||
|
||||
void check_for_interruption()
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
if(thread_info->interrupt_requested)
|
||||
{
|
||||
thread_info->interrupt_requested=false;
|
||||
throw thread_interrupted(); // BOOST_NO_EXCEPTIONS protected
|
||||
throw thread_interrupted();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void operator=(interruption_checker&);
|
||||
@@ -193,43 +175,7 @@ namespace boost
|
||||
namespace this_thread
|
||||
{
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
inline
|
||||
void BOOST_SYMBOL_VISIBLE sleep_for(const chrono::nanoseconds& ns)
|
||||
{
|
||||
using namespace chrono;
|
||||
boost::detail::thread_data_base* const thread_info=boost::detail::get_current_thread_data();
|
||||
|
||||
if(thread_info)
|
||||
{
|
||||
unique_lock<mutex> lk(thread_info->sleep_mutex);
|
||||
while(cv_status::no_timeout==thread_info->sleep_condition.wait_for(lk,ns)) {}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ns >= nanoseconds::zero())
|
||||
{
|
||||
|
||||
# if defined(BOOST_HAS_PTHREAD_DELAY_NP)
|
||||
timespec ts;
|
||||
ts.tv_sec = static_cast<long>(duration_cast<seconds>(ns).count());
|
||||
ts.tv_nsec = static_cast<long>((ns - seconds(ts.tv_sec)).count());
|
||||
BOOST_VERIFY(!pthread_delay_np(&ts));
|
||||
# elif defined(BOOST_HAS_NANOSLEEP)
|
||||
timespec ts;
|
||||
ts.tv_sec = static_cast<long>(duration_cast<seconds>(ns).count());
|
||||
ts.tv_nsec = static_cast<long>((ns - seconds(ts.tv_sec)).count());
|
||||
// nanosleep takes a timespec that is an offset, not
|
||||
// an absolute time.
|
||||
nanosleep(&ts, 0);
|
||||
# else
|
||||
mutex mx;
|
||||
mutex::scoped_lock lock(mx);
|
||||
condition_variable cond;
|
||||
cond.wait_for(lock, ns);
|
||||
# endif
|
||||
}
|
||||
}
|
||||
}
|
||||
void BOOST_SYMBOL_VISIBLE sleep_for(const chrono::nanoseconds& ns);
|
||||
#endif
|
||||
void BOOST_THREAD_DECL yield() BOOST_NOEXCEPT;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace boost
|
||||
return new T();
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template<typename T,typename A1>
|
||||
inline T* heap_new(A1&& a1)
|
||||
{
|
||||
@@ -72,7 +72,7 @@ namespace boost
|
||||
{
|
||||
return heap_new_impl<T,A1&>(a1);
|
||||
}
|
||||
|
||||
|
||||
template<typename T,typename A1,typename A2>
|
||||
inline T* heap_new(A1 const& a1,A2 const& a2)
|
||||
{
|
||||
@@ -218,8 +218,8 @@ namespace boost
|
||||
{
|
||||
return heap_new_impl<T,A1&,A2&,A3&,A4&>(a1,a2,a3,a4);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
template<typename T>
|
||||
inline void heap_delete(T* data)
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace boost
|
||||
mutex.destroy();
|
||||
}
|
||||
|
||||
bool try_lock() BOOST_NOEXCEPT
|
||||
bool try_lock()
|
||||
{
|
||||
long const current_thread_id=win32::GetCurrentThreadId();
|
||||
return try_recursive_lock(current_thread_id) || try_basic_lock(current_thread_id);
|
||||
@@ -93,7 +93,7 @@ namespace boost
|
||||
}
|
||||
|
||||
private:
|
||||
bool try_recursive_lock(long current_thread_id) BOOST_NOEXCEPT
|
||||
bool try_recursive_lock(long current_thread_id)
|
||||
{
|
||||
if(::boost::detail::interlocked_read_acquire(&locking_thread_id)==current_thread_id)
|
||||
{
|
||||
@@ -103,7 +103,7 @@ namespace boost
|
||||
return false;
|
||||
}
|
||||
|
||||
bool try_basic_lock(long current_thread_id) BOOST_NOEXCEPT
|
||||
bool try_basic_lock(long current_thread_id)
|
||||
{
|
||||
if(mutex.try_lock())
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace boost
|
||||
}
|
||||
|
||||
|
||||
bool try_lock() BOOST_NOEXCEPT
|
||||
bool try_lock()
|
||||
{
|
||||
return !win32::interlocked_bit_test_and_set(&active_count,lock_flag_bit);
|
||||
}
|
||||
@@ -159,7 +159,6 @@ namespace boost
|
||||
return timed_lock(system_time(timeout));
|
||||
}
|
||||
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
template <class Rep, class Period>
|
||||
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time)
|
||||
{
|
||||
@@ -210,7 +209,6 @@ namespace boost
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void unlock()
|
||||
{
|
||||
|
||||
@@ -6,27 +6,23 @@
|
||||
// (C) Copyright 2007-8 Anthony Williams
|
||||
// (C) Copyright 2011-2012 Vicente J. Botet Escriba
|
||||
|
||||
#include <boost/thread/win32/thread_primitives.hpp>
|
||||
#include <boost/thread/win32/thread_data.hpp>
|
||||
#include <boost/thread/win32/thread_data.hpp>
|
||||
#include <boost/thread/win32/interlocked_read.hpp>
|
||||
#include <boost/thread/cv_status.hpp>
|
||||
#include <boost/thread/xtime.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/thread_time.hpp>
|
||||
|
||||
#include <boost/thread/win32/thread_primitives.hpp>
|
||||
#include <limits.h>
|
||||
#include <boost/assert.hpp>
|
||||
#include <algorithm>
|
||||
#include <boost/thread/cv_status.hpp>
|
||||
#include <boost/thread/win32/thread_data.hpp>
|
||||
#include <boost/thread/thread_time.hpp>
|
||||
#include <boost/thread/win32/interlocked_read.hpp>
|
||||
#include <boost/thread/xtime.hpp>
|
||||
#include <vector>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
#include <boost/chrono/system_clocks.hpp>
|
||||
#include <boost/chrono/ceil.hpp>
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/config/abi_prefix.hpp>
|
||||
|
||||
namespace boost
|
||||
@@ -85,9 +81,9 @@ namespace boost
|
||||
return notified;
|
||||
}
|
||||
|
||||
bool wait(timeout abs_time)
|
||||
bool wait(timeout wait_until)
|
||||
{
|
||||
return this_thread::interruptible_wait(semaphore,abs_time);
|
||||
return this_thread::interruptible_wait(semaphore,wait_until);
|
||||
}
|
||||
|
||||
bool woken()
|
||||
@@ -195,10 +191,7 @@ namespace boost
|
||||
|
||||
~entry_manager()
|
||||
{
|
||||
if(! entry->is_notified())
|
||||
{
|
||||
entry->remove_waiter();
|
||||
}
|
||||
}
|
||||
|
||||
list_entry* operator->()
|
||||
@@ -210,7 +203,7 @@ namespace boost
|
||||
|
||||
protected:
|
||||
template<typename lock_type>
|
||||
bool do_wait(lock_type& lock,timeout abs_time)
|
||||
bool do_wait(lock_type& lock,timeout wait_until)
|
||||
{
|
||||
relocker<lock_type> locker(lock);
|
||||
|
||||
@@ -221,7 +214,7 @@ namespace boost
|
||||
bool woken=false;
|
||||
while(!woken)
|
||||
{
|
||||
if(!entry->wait(abs_time))
|
||||
if(!entry->wait(wait_until))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -232,11 +225,11 @@ namespace boost
|
||||
}
|
||||
|
||||
template<typename lock_type,typename predicate_type>
|
||||
bool do_wait(lock_type& m,timeout const& abs_time,predicate_type pred)
|
||||
bool do_wait(lock_type& m,timeout const& wait_until,predicate_type pred)
|
||||
{
|
||||
while (!pred())
|
||||
{
|
||||
if(!do_wait(m, abs_time))
|
||||
if(!do_wait(m, wait_until))
|
||||
return pred();
|
||||
}
|
||||
return true;
|
||||
@@ -321,14 +314,14 @@ namespace boost
|
||||
}
|
||||
|
||||
|
||||
bool timed_wait(unique_lock<mutex>& m,boost::system_time const& abs_time)
|
||||
bool timed_wait(unique_lock<mutex>& m,boost::system_time const& wait_until)
|
||||
{
|
||||
return do_wait(m,abs_time);
|
||||
return do_wait(m,wait_until);
|
||||
}
|
||||
|
||||
bool timed_wait(unique_lock<mutex>& m,boost::xtime const& abs_time)
|
||||
bool timed_wait(unique_lock<mutex>& m,boost::xtime const& wait_until)
|
||||
{
|
||||
return do_wait(m,system_time(abs_time));
|
||||
return do_wait(m,system_time(wait_until));
|
||||
}
|
||||
template<typename duration_type>
|
||||
bool timed_wait(unique_lock<mutex>& m,duration_type const& wait_duration)
|
||||
@@ -337,14 +330,14 @@ namespace boost
|
||||
}
|
||||
|
||||
template<typename predicate_type>
|
||||
bool timed_wait(unique_lock<mutex>& m,boost::system_time const& abs_time,predicate_type pred)
|
||||
bool timed_wait(unique_lock<mutex>& m,boost::system_time const& wait_until,predicate_type pred)
|
||||
{
|
||||
return do_wait(m,abs_time,pred);
|
||||
return do_wait(m,wait_until,pred);
|
||||
}
|
||||
template<typename predicate_type>
|
||||
bool timed_wait(unique_lock<mutex>& m,boost::xtime const& abs_time,predicate_type pred)
|
||||
bool timed_wait(unique_lock<mutex>& m,boost::xtime const& wait_until,predicate_type pred)
|
||||
{
|
||||
return do_wait(m,system_time(abs_time),pred);
|
||||
return do_wait(m,system_time(wait_until),pred);
|
||||
}
|
||||
template<typename duration_type,typename predicate_type>
|
||||
bool timed_wait(unique_lock<mutex>& m,duration_type const& wait_duration,predicate_type pred)
|
||||
@@ -429,15 +422,15 @@ namespace boost
|
||||
}
|
||||
|
||||
template<typename lock_type>
|
||||
bool timed_wait(lock_type& m,boost::system_time const& abs_time)
|
||||
bool timed_wait(lock_type& m,boost::system_time const& wait_until)
|
||||
{
|
||||
return do_wait(m,abs_time);
|
||||
return do_wait(m,wait_until);
|
||||
}
|
||||
|
||||
template<typename lock_type>
|
||||
bool timed_wait(lock_type& m,boost::xtime const& abs_time)
|
||||
bool timed_wait(lock_type& m,boost::xtime const& wait_until)
|
||||
{
|
||||
return do_wait(m,system_time(abs_time));
|
||||
return do_wait(m,system_time(wait_until));
|
||||
}
|
||||
|
||||
template<typename lock_type,typename duration_type>
|
||||
@@ -447,15 +440,15 @@ namespace boost
|
||||
}
|
||||
|
||||
template<typename lock_type,typename predicate_type>
|
||||
bool timed_wait(lock_type& m,boost::system_time const& abs_time,predicate_type pred)
|
||||
bool timed_wait(lock_type& m,boost::system_time const& wait_until,predicate_type pred)
|
||||
{
|
||||
return do_wait(m,abs_time,pred);
|
||||
return do_wait(m,wait_until,pred);
|
||||
}
|
||||
|
||||
template<typename lock_type,typename predicate_type>
|
||||
bool timed_wait(lock_type& m,boost::xtime const& abs_time,predicate_type pred)
|
||||
bool timed_wait(lock_type& m,boost::xtime const& wait_until,predicate_type pred)
|
||||
{
|
||||
return do_wait(m,system_time(abs_time),pred);
|
||||
return do_wait(m,system_time(wait_until),pred);
|
||||
}
|
||||
|
||||
template<typename lock_type,typename duration_type,typename predicate_type>
|
||||
@@ -517,7 +510,6 @@ namespace boost
|
||||
#endif
|
||||
};
|
||||
|
||||
BOOST_THREAD_DECL void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
}
|
||||
|
||||
#include <boost/config/abi_suffix.hpp>
|
||||
|
||||
@@ -3,15 +3,13 @@
|
||||
|
||||
// interlocked_read_win32.hpp
|
||||
//
|
||||
// (C) Copyright 2005-8 Anthony Williams
|
||||
// (C) Copyright 2012 Vicente J. Botet Escriba
|
||||
// (C) Copyright 2005-8 Anthony Williams
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/detail/interlocked.hpp>
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
|
||||
#include <boost/config/abi_prefix.hpp>
|
||||
|
||||
@@ -24,25 +22,25 @@ namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
inline long interlocked_read_acquire(long volatile* x) BOOST_NOEXCEPT
|
||||
inline long interlocked_read_acquire(long volatile* x)
|
||||
{
|
||||
long const res=*x;
|
||||
_ReadWriteBarrier();
|
||||
return res;
|
||||
}
|
||||
inline void* interlocked_read_acquire(void* volatile* x) BOOST_NOEXCEPT
|
||||
inline void* interlocked_read_acquire(void* volatile* x)
|
||||
{
|
||||
void* const res=*x;
|
||||
_ReadWriteBarrier();
|
||||
return res;
|
||||
}
|
||||
|
||||
inline void interlocked_write_release(long volatile* x,long value) BOOST_NOEXCEPT
|
||||
inline void interlocked_write_release(long volatile* x,long value)
|
||||
{
|
||||
_ReadWriteBarrier();
|
||||
*x=value;
|
||||
}
|
||||
inline void interlocked_write_release(void* volatile* x,void* value) BOOST_NOEXCEPT
|
||||
inline void interlocked_write_release(void* volatile* x,void* value)
|
||||
{
|
||||
_ReadWriteBarrier();
|
||||
*x=value;
|
||||
@@ -56,19 +54,19 @@ namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
inline long interlocked_read_acquire(long volatile* x) BOOST_NOEXCEPT
|
||||
inline long interlocked_read_acquire(long volatile* x)
|
||||
{
|
||||
return BOOST_INTERLOCKED_COMPARE_EXCHANGE(x,0,0);
|
||||
}
|
||||
inline void* interlocked_read_acquire(void* volatile* x) BOOST_NOEXCEPT
|
||||
inline void* interlocked_read_acquire(void* volatile* x)
|
||||
{
|
||||
return BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(x,0,0);
|
||||
}
|
||||
inline void interlocked_write_release(long volatile* x,long value) BOOST_NOEXCEPT
|
||||
inline void interlocked_write_release(long volatile* x,long value)
|
||||
{
|
||||
BOOST_INTERLOCKED_EXCHANGE(x,value);
|
||||
}
|
||||
inline void interlocked_write_release(void* volatile* x,void* value) BOOST_NOEXCEPT
|
||||
inline void interlocked_write_release(void* volatile* x,void* value)
|
||||
{
|
||||
BOOST_INTERLOCKED_EXCHANGE_POINTER(x,value);
|
||||
}
|
||||
|
||||
@@ -157,9 +157,7 @@ namespace boost
|
||||
status=BOOST_INTERLOCKED_COMPARE_EXCHANGE(&flag.status,running_value,0);
|
||||
if(!status)
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try // BOOST_NO_EXCEPTIONS protected
|
||||
#endif
|
||||
try
|
||||
{
|
||||
if(!event_handle)
|
||||
{
|
||||
@@ -187,8 +185,7 @@ namespace boost
|
||||
}
|
||||
break;
|
||||
}
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
catch(...) // BOOST_NO_EXCEPTIONS protected
|
||||
catch(...)
|
||||
{
|
||||
BOOST_INTERLOCKED_EXCHANGE(&flag.status,0);
|
||||
if(!event_handle)
|
||||
@@ -199,9 +196,8 @@ namespace boost
|
||||
{
|
||||
::boost::detail::win32::SetEvent(event_handle);
|
||||
}
|
||||
throw; // BOOST_NO_EXCEPTIONS protected
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
if(!counted)
|
||||
|
||||
@@ -221,7 +221,6 @@ namespace boost
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
template <class Rep, class Period>
|
||||
bool try_lock_shared_for(const chrono::duration<Rep, Period>& rel_time)
|
||||
{
|
||||
@@ -328,7 +327,6 @@ namespace boost
|
||||
BOOST_ASSERT(res==0);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void unlock_shared()
|
||||
{
|
||||
@@ -492,7 +490,7 @@ namespace boost
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
|
||||
template <class Rep, class Period>
|
||||
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time)
|
||||
{
|
||||
@@ -600,7 +598,6 @@ namespace boost
|
||||
BOOST_ASSERT(wait_res<2);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void unlock()
|
||||
{
|
||||
|
||||
@@ -7,26 +7,17 @@
|
||||
// (C) Copyright 2011-2012 Vicente J. Botet Escriba
|
||||
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
#include <boost/thread/thread_time.hpp>
|
||||
#include <boost/thread/win32/thread_primitives.hpp>
|
||||
#include <boost/thread/win32/thread_heap_alloc.hpp>
|
||||
|
||||
#include <boost/intrusive_ptr.hpp>
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
#include <boost/chrono/system_clocks.hpp>
|
||||
#endif
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
#include <boost/config/abi_prefix.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
class condition_variable;
|
||||
class mutex;
|
||||
|
||||
class thread_attributes {
|
||||
public:
|
||||
thread_attributes() BOOST_NOEXCEPT {
|
||||
@@ -67,47 +58,32 @@ namespace boost
|
||||
|
||||
namespace detail
|
||||
{
|
||||
struct tss_cleanup_function;
|
||||
struct thread_exit_callback_node;
|
||||
struct tss_data_node
|
||||
{
|
||||
boost::shared_ptr<boost::detail::tss_cleanup_function> func;
|
||||
void* value;
|
||||
|
||||
tss_data_node(boost::shared_ptr<boost::detail::tss_cleanup_function> func_,
|
||||
void* value_):
|
||||
func(func_),value(value_)
|
||||
{}
|
||||
};
|
||||
struct tss_data_node;
|
||||
|
||||
struct thread_data_base;
|
||||
void intrusive_ptr_add_ref(thread_data_base * p);
|
||||
void intrusive_ptr_release(thread_data_base * p);
|
||||
|
||||
struct BOOST_THREAD_DECL thread_data_base
|
||||
struct BOOST_SYMBOL_VISIBLE thread_data_base
|
||||
{
|
||||
long count;
|
||||
detail::win32::handle_manager thread_handle;
|
||||
detail::win32::handle_manager interruption_handle;
|
||||
boost::detail::thread_exit_callback_node* thread_exit_callbacks;
|
||||
std::map<void const*,boost::detail::tss_data_node> tss_data;
|
||||
boost::detail::tss_data_node* tss_data;
|
||||
bool interruption_enabled;
|
||||
unsigned id;
|
||||
typedef std::vector<std::pair<condition_variable*, mutex*>
|
||||
//, hidden_allocator<std::pair<condition_variable*, mutex*> >
|
||||
> notify_list_t;
|
||||
notify_list_t notify;
|
||||
|
||||
|
||||
thread_data_base():
|
||||
count(0),thread_handle(detail::win32::invalid_handle_value),
|
||||
interruption_handle(create_anonymous_event(detail::win32::manual_reset_event,detail::win32::event_initially_reset)),
|
||||
thread_exit_callbacks(0),tss_data(),
|
||||
thread_exit_callbacks(0),tss_data(0),
|
||||
interruption_enabled(true),
|
||||
id(0),
|
||||
notify()
|
||||
id(0)
|
||||
{}
|
||||
virtual ~thread_data_base()
|
||||
{}
|
||||
virtual ~thread_data_base();
|
||||
|
||||
friend void intrusive_ptr_add_ref(thread_data_base * p)
|
||||
{
|
||||
@@ -130,12 +106,6 @@ namespace boost
|
||||
typedef detail::win32::handle native_handle_type;
|
||||
|
||||
virtual void run()=0;
|
||||
|
||||
void notify_all_at_thread_exit(condition_variable* cv, mutex* m)
|
||||
{
|
||||
notify.push_back(std::pair<condition_variable*, mutex*>(cv, m));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
typedef boost::intrusive_ptr<detail::thread_data_base> thread_data_ptr;
|
||||
|
||||
@@ -75,180 +75,144 @@ namespace boost
|
||||
inline T* heap_new()
|
||||
{
|
||||
void* const heap_memory=allocate_raw_heap_memory(sizeof(T));
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try // BOOST_NO_EXCEPTIONS protected
|
||||
#endif
|
||||
try
|
||||
{
|
||||
T* const data=new (heap_memory) T();
|
||||
return data;
|
||||
}
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
catch(...) // BOOST_NO_EXCEPTIONS protected
|
||||
catch(...)
|
||||
{
|
||||
free_raw_heap_memory(heap_memory);
|
||||
throw; // BOOST_NO_EXCEPTIONS protected
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
|
||||
#ifndef BOOST_NO_RVALUE_REFERENCES
|
||||
template<typename T,typename A1>
|
||||
inline T* heap_new(A1&& a1)
|
||||
{
|
||||
void* const heap_memory=allocate_raw_heap_memory(sizeof(T));
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try // BOOST_NO_EXCEPTIONS protected
|
||||
#endif
|
||||
try
|
||||
{
|
||||
T* const data=new (heap_memory) T(static_cast<A1&&>(a1));
|
||||
return data;
|
||||
}
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
catch(...) // BOOST_NO_EXCEPTIONS protected
|
||||
catch(...)
|
||||
{
|
||||
free_raw_heap_memory(heap_memory);
|
||||
throw; // BOOST_NO_EXCEPTIONS protected
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
template<typename T,typename A1,typename A2>
|
||||
inline T* heap_new(A1&& a1,A2&& a2)
|
||||
{
|
||||
void* const heap_memory=allocate_raw_heap_memory(sizeof(T));
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try // BOOST_NO_EXCEPTIONS protected
|
||||
#endif
|
||||
try
|
||||
{
|
||||
T* const data=new (heap_memory) T(static_cast<A1&&>(a1),static_cast<A2&&>(a2));
|
||||
return data;
|
||||
}
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
catch(...) // BOOST_NO_EXCEPTIONS protected
|
||||
catch(...)
|
||||
{
|
||||
free_raw_heap_memory(heap_memory);
|
||||
throw; // BOOST_NO_EXCEPTIONS protected
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
template<typename T,typename A1,typename A2,typename A3>
|
||||
inline T* heap_new(A1&& a1,A2&& a2,A3&& a3)
|
||||
{
|
||||
void* const heap_memory=allocate_raw_heap_memory(sizeof(T));
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try // BOOST_NO_EXCEPTIONS protected
|
||||
#endif
|
||||
try
|
||||
{
|
||||
T* const data=new (heap_memory) T(static_cast<A1&&>(a1),static_cast<A2&&>(a2),
|
||||
static_cast<A3&&>(a3));
|
||||
return data;
|
||||
}
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
catch(...) // BOOST_NO_EXCEPTIONS protected
|
||||
catch(...)
|
||||
{
|
||||
free_raw_heap_memory(heap_memory);
|
||||
throw; // BOOST_NO_EXCEPTIONS protected
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
template<typename T,typename A1,typename A2,typename A3,typename A4>
|
||||
inline T* heap_new(A1&& a1,A2&& a2,A3&& a3,A4&& a4)
|
||||
{
|
||||
void* const heap_memory=allocate_raw_heap_memory(sizeof(T));
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try // BOOST_NO_EXCEPTIONS protected
|
||||
#endif
|
||||
try
|
||||
{
|
||||
T* const data=new (heap_memory) T(static_cast<A1&&>(a1),static_cast<A2&&>(a2),
|
||||
static_cast<A3&&>(a3),static_cast<A4&&>(a4));
|
||||
return data;
|
||||
}
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
catch(...) // BOOST_NO_EXCEPTIONS protected
|
||||
catch(...)
|
||||
{
|
||||
free_raw_heap_memory(heap_memory);
|
||||
throw; // BOOST_NO_EXCEPTIONS protected
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
template<typename T,typename A1>
|
||||
inline T* heap_new_impl(A1 a1)
|
||||
{
|
||||
void* const heap_memory=allocate_raw_heap_memory(sizeof(T));
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try // BOOST_NO_EXCEPTIONS protected
|
||||
#endif
|
||||
try
|
||||
{
|
||||
T* const data=new (heap_memory) T(a1);
|
||||
return data;
|
||||
}
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
catch(...) // BOOST_NO_EXCEPTIONS protected
|
||||
catch(...)
|
||||
{
|
||||
free_raw_heap_memory(heap_memory);
|
||||
throw; // BOOST_NO_EXCEPTIONS protected
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename T,typename A1,typename A2>
|
||||
inline T* heap_new_impl(A1 a1,A2 a2)
|
||||
{
|
||||
void* const heap_memory=allocate_raw_heap_memory(sizeof(T));
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try // BOOST_NO_EXCEPTIONS protected
|
||||
#endif
|
||||
try
|
||||
{
|
||||
T* const data=new (heap_memory) T(a1,a2);
|
||||
return data;
|
||||
}
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
catch(...) // BOOST_NO_EXCEPTIONS protected
|
||||
catch(...)
|
||||
{
|
||||
free_raw_heap_memory(heap_memory);
|
||||
throw; // BOOST_NO_EXCEPTIONS protected
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename T,typename A1,typename A2,typename A3>
|
||||
inline T* heap_new_impl(A1 a1,A2 a2,A3 a3)
|
||||
{
|
||||
void* const heap_memory=allocate_raw_heap_memory(sizeof(T));
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try // BOOST_NO_EXCEPTIONS protected
|
||||
#endif
|
||||
try
|
||||
{
|
||||
T* const data=new (heap_memory) T(a1,a2,a3);
|
||||
return data;
|
||||
}
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
catch(...) // BOOST_NO_EXCEPTIONS protected
|
||||
catch(...)
|
||||
{
|
||||
free_raw_heap_memory(heap_memory);
|
||||
throw; // BOOST_NO_EXCEPTIONS protected
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template<typename T,typename A1,typename A2,typename A3,typename A4>
|
||||
inline T* heap_new_impl(A1 a1,A2 a2,A3 a3,A4 a4)
|
||||
{
|
||||
void* const heap_memory=allocate_raw_heap_memory(sizeof(T));
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try // BOOST_NO_EXCEPTIONS protected
|
||||
#endif
|
||||
try
|
||||
{
|
||||
T* const data=new (heap_memory) T(a1,a2,a3,a4);
|
||||
return data;
|
||||
}
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
catch(...) // BOOST_NO_EXCEPTIONS protected
|
||||
catch(...)
|
||||
{
|
||||
free_raw_heap_memory(heap_memory);
|
||||
throw; // BOOST_NO_EXCEPTIONS protected
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/thread/exceptions.hpp>
|
||||
@@ -341,48 +341,22 @@ namespace boost
|
||||
{
|
||||
inline bool interlocked_bit_test_and_set(long* x,long bit)
|
||||
{
|
||||
#ifndef BOOST_INTEL_CXX_VERSION
|
||||
__asm {
|
||||
mov eax,bit;
|
||||
mov edx,x;
|
||||
lock bts [edx],eax;
|
||||
setc al;
|
||||
};
|
||||
#else
|
||||
bool ret;
|
||||
__asm {
|
||||
mov eax,bit
|
||||
mov edx,x
|
||||
lock bts [edx],eax
|
||||
setc al
|
||||
mov ret, al
|
||||
};
|
||||
return ret;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool interlocked_bit_test_and_reset(long* x,long bit)
|
||||
{
|
||||
#ifndef BOOST_INTEL_CXX_VERSION
|
||||
__asm {
|
||||
mov eax,bit;
|
||||
mov edx,x;
|
||||
lock btr [edx],eax;
|
||||
setc al;
|
||||
};
|
||||
#else
|
||||
bool ret;
|
||||
__asm {
|
||||
mov eax,bit
|
||||
mov edx,x
|
||||
lock btr [edx],eax
|
||||
setc al
|
||||
mov ret, al
|
||||
};
|
||||
return ret;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// William E. Kempf
|
||||
// Copyright (C) 2007-8 Anthony Williams
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_XTIME_WEK070601_HPP
|
||||
@@ -20,7 +20,7 @@ namespace boost {
|
||||
|
||||
enum xtime_clock_types
|
||||
{
|
||||
TIME_UTC_=1
|
||||
TIME_UTC=1
|
||||
// TIME_TAI,
|
||||
// TIME_MONOTONIC,
|
||||
// TIME_PROCESS,
|
||||
@@ -53,14 +53,14 @@ struct xtime
|
||||
boost::posix_time::microseconds((nsec+500)/1000);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
inline xtime get_xtime(boost::system_time const& abs_time)
|
||||
{
|
||||
xtime res;
|
||||
boost::posix_time::time_duration const time_since_epoch=abs_time-boost::posix_time::from_time_t(0);
|
||||
|
||||
|
||||
res.sec=static_cast<xtime::xtime_sec_t>(time_since_epoch.total_seconds());
|
||||
res.nsec=static_cast<xtime::xtime_nsec_t>(time_since_epoch.fractional_seconds()*(1000000000/time_since_epoch.ticks_per_second()));
|
||||
return res;
|
||||
@@ -68,7 +68,7 @@ inline xtime get_xtime(boost::system_time const& abs_time)
|
||||
|
||||
inline int xtime_get(struct xtime* xtp, int clock_type)
|
||||
{
|
||||
if (clock_type == TIME_UTC_)
|
||||
if (clock_type == TIME_UTC)
|
||||
{
|
||||
*xtp=get_xtime(get_system_time());
|
||||
return clock_type;
|
||||
@@ -81,7 +81,7 @@ inline int xtime_cmp(const xtime& xt1, const xtime& xt2)
|
||||
{
|
||||
if (xt1.sec == xt2.sec)
|
||||
return (int)(xt1.nsec - xt2.nsec);
|
||||
else
|
||||
else
|
||||
return (xt1.sec > xt2.sec) ? 1 : -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
|
||||
|
||||
#include <boost/thread/future.hpp>
|
||||
|
||||
namespace boost
|
||||
@@ -51,11 +47,10 @@ namespace boost
|
||||
}
|
||||
|
||||
const system::error_category&
|
||||
future_category() BOOST_NOEXCEPT
|
||||
future_category()
|
||||
{
|
||||
static thread_detail::future_error_category f;
|
||||
return f;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
BOOST_THREAD_DECL thread_detail::uintmax_atomic_t once_global_epoch=BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_MAX_C;
|
||||
BOOST_THREAD_DECL boost::uintmax_t once_global_epoch=UINTMAX_C(~0);
|
||||
BOOST_THREAD_DECL pthread_mutex_t once_epoch_mutex=PTHREAD_MUTEX_INITIALIZER;
|
||||
BOOST_THREAD_DECL pthread_cond_t once_epoch_cv = PTHREAD_COND_INITIALIZER;
|
||||
|
||||
@@ -55,17 +55,17 @@ namespace boost
|
||||
#endif
|
||||
}
|
||||
|
||||
thread_detail::uintmax_atomic_t& get_once_per_thread_epoch()
|
||||
boost::uintmax_t& get_once_per_thread_epoch()
|
||||
{
|
||||
BOOST_VERIFY(!pthread_once(&epoch_tss_key_flag,create_epoch_tss_key));
|
||||
void* data=pthread_getspecific(epoch_tss_key);
|
||||
if(!data)
|
||||
{
|
||||
data=malloc(sizeof(thread_detail::uintmax_atomic_t));
|
||||
data=malloc(sizeof(boost::uintmax_t));
|
||||
BOOST_VERIFY(!pthread_setspecific(epoch_tss_key,data));
|
||||
*static_cast<thread_detail::uintmax_atomic_t*>(data)=BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_MAX_C;
|
||||
*static_cast<boost::uintmax_t*>(data)=UINTMAX_C(~0);
|
||||
}
|
||||
return *static_cast<thread_detail::uintmax_atomic_t*>(data);
|
||||
return *static_cast<boost::uintmax_t*>(data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,12 +10,11 @@
|
||||
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <boost/thread/xtime.hpp>
|
||||
#include <boost/thread/condition_variable.hpp>
|
||||
#include <boost/thread/condition.hpp>
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/once.hpp>
|
||||
#include <boost/thread/tss.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#ifdef __GLIBC__
|
||||
#include <sys/sysinfo.h>
|
||||
#elif defined(__APPLE__) || defined(__FreeBSD__)
|
||||
@@ -25,23 +24,14 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "./timeconv.inl"
|
||||
#include "timeconv.inl"
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
thread_data_base::~thread_data_base()
|
||||
{
|
||||
{
|
||||
for (notify_list_t::iterator i = notify.begin(), e = notify.end();
|
||||
i != e; ++i)
|
||||
{
|
||||
i->second->unlock();
|
||||
i->first->notify_all();
|
||||
}
|
||||
}
|
||||
}
|
||||
{}
|
||||
|
||||
struct thread_exit_callback_node
|
||||
{
|
||||
@@ -148,17 +138,16 @@ namespace boost
|
||||
boost::detail::thread_data_ptr thread_info = static_cast<boost::detail::thread_data_base*>(param)->self;
|
||||
thread_info->self.reset();
|
||||
detail::set_current_thread_data(thread_info.get());
|
||||
BOOST_TRY
|
||||
try
|
||||
{
|
||||
thread_info->run();
|
||||
}
|
||||
BOOST_CATCH (thread_interrupted const&)
|
||||
catch(thread_interrupted const&)
|
||||
{
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
// Removed as it stops the debugger identifying the cause of the exception
|
||||
// Unhandled exceptions still cause the application to terminate
|
||||
// BOOST_CATCH(...)
|
||||
// catch(...)
|
||||
// {
|
||||
// std::terminate();
|
||||
// }
|
||||
@@ -182,8 +171,6 @@ namespace boost
|
||||
|
||||
void run()
|
||||
{}
|
||||
void notify_all_at_thread_exit(condition_variable*, mutex*)
|
||||
{}
|
||||
|
||||
private:
|
||||
externally_launched_thread(externally_launched_thread&);
|
||||
@@ -234,14 +221,14 @@ namespace boost
|
||||
if (res != 0)
|
||||
{
|
||||
thread_info->self.reset();
|
||||
boost::throw_exception(thread_resource_error());
|
||||
throw thread_resource_error();
|
||||
}
|
||||
int detached_state;
|
||||
res = pthread_attr_getdetachstate(h, &detached_state);
|
||||
if (res != 0)
|
||||
{
|
||||
thread_info->self.reset();
|
||||
boost::throw_exception(thread_resource_error());
|
||||
throw thread_resource_error();
|
||||
}
|
||||
if (PTHREAD_CREATE_DETACHED==detached_state)
|
||||
{
|
||||
@@ -313,12 +300,6 @@ namespace boost
|
||||
thread_info.reset();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED
|
||||
boost::throw_exception(thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable"));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
bool thread::do_try_join_until(struct timespec const &timeout)
|
||||
@@ -368,14 +349,8 @@ namespace boost
|
||||
{
|
||||
thread_info.reset();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED
|
||||
boost::throw_exception(thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable"));
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool thread::joinable() const BOOST_NOEXCEPT
|
||||
@@ -384,7 +359,7 @@ namespace boost
|
||||
}
|
||||
|
||||
|
||||
void thread::detach()
|
||||
void thread::detach() BOOST_NOEXCEPT
|
||||
{
|
||||
detail::thread_data_ptr local_thread_info;
|
||||
thread_info.swap(local_thread_info);
|
||||
@@ -441,13 +416,40 @@ namespace boost
|
||||
cond.timed_wait(lock, xt);
|
||||
# endif
|
||||
xtime cur;
|
||||
xtime_get(&cur, TIME_UTC_);
|
||||
xtime_get(&cur, TIME_UTC);
|
||||
if (xtime_cmp(xt, cur) <= 0)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
void
|
||||
sleep_for(const chrono::nanoseconds& ns)
|
||||
{
|
||||
using namespace chrono;
|
||||
if (ns >= nanoseconds::zero())
|
||||
{
|
||||
timespec ts;
|
||||
ts.tv_sec = static_cast<long>(duration_cast<seconds>(ns).count());
|
||||
ts.tv_nsec = static_cast<long>((ns - seconds(ts.tv_sec)).count());
|
||||
|
||||
# if defined(BOOST_HAS_PTHREAD_DELAY_NP)
|
||||
BOOST_VERIFY(!pthread_delay_np(&ts));
|
||||
# elif defined(BOOST_HAS_NANOSLEEP)
|
||||
// nanosleep takes a timespec that is an offset, not
|
||||
// an absolute time.
|
||||
nanosleep(&ts, 0);
|
||||
# else
|
||||
mutex mx;
|
||||
mutex::scoped_lock lock(mx);
|
||||
condition_variable cond;
|
||||
cond.wait_for(lock, ns);
|
||||
# endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void yield() BOOST_NOEXCEPT
|
||||
{
|
||||
# if defined(BOOST_HAS_SCHED_YIELD)
|
||||
@@ -456,7 +458,7 @@ namespace boost
|
||||
BOOST_VERIFY(!pthread_yield());
|
||||
# else
|
||||
xtime xt;
|
||||
xtime_get(&xt, TIME_UTC_);
|
||||
xtime_get(&xt, TIME_UTC);
|
||||
sleep(xt);
|
||||
# endif
|
||||
}
|
||||
@@ -556,7 +558,6 @@ namespace boost
|
||||
|
||||
void interruption_point()
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
boost::detail::thread_data_base* const thread_info=detail::get_current_thread_data();
|
||||
if(thread_info && thread_info->interrupt_enabled)
|
||||
{
|
||||
@@ -567,7 +568,6 @@ namespace boost
|
||||
throw thread_interrupted();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
bool interruption_enabled() BOOST_NOEXCEPT
|
||||
@@ -646,7 +646,7 @@ namespace boost
|
||||
return ¤t_node->second;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* get_tss_data(void const* key)
|
||||
@@ -655,7 +655,7 @@ namespace boost
|
||||
{
|
||||
return current_node->value;
|
||||
}
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void add_new_tss_node(void const* key,
|
||||
@@ -692,21 +692,12 @@ namespace boost
|
||||
erase_tss_node(key);
|
||||
}
|
||||
}
|
||||
else if(func || (tss_data!=0))
|
||||
else
|
||||
{
|
||||
add_new_tss_node(key,func,tss_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
BOOST_THREAD_DECL void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk)
|
||||
{
|
||||
detail::thread_data_base* const current_thread_data(detail::get_current_thread_data());
|
||||
if(current_thread_data)
|
||||
{
|
||||
current_thread_data->notify_all_at_thread_exit(&cond, lk.release());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,8 +20,8 @@ const int NANOSECONDS_PER_MICROSECOND = 1000;
|
||||
inline void to_time(int milliseconds, boost::xtime& xt)
|
||||
{
|
||||
int res = 0;
|
||||
res = boost::xtime_get(&xt, boost::TIME_UTC_);
|
||||
BOOST_ASSERT(res == boost::TIME_UTC_); (void)res;
|
||||
res = boost::xtime_get(&xt, boost::TIME_UTC);
|
||||
BOOST_ASSERT(res == boost::TIME_UTC); (void)res;
|
||||
|
||||
xt.sec += (milliseconds / MILLISECONDS_PER_SECOND);
|
||||
xt.nsec += ((milliseconds % MILLISECONDS_PER_SECOND) *
|
||||
@@ -56,8 +56,8 @@ inline void to_timespec_duration(const boost::xtime& xt, timespec& ts)
|
||||
{
|
||||
boost::xtime cur;
|
||||
int res = 0;
|
||||
res = boost::xtime_get(&cur, boost::TIME_UTC_);
|
||||
BOOST_ASSERT(res == boost::TIME_UTC_); (void)res;
|
||||
res = boost::xtime_get(&cur, boost::TIME_UTC);
|
||||
BOOST_ASSERT(res == boost::TIME_UTC); (void)res;
|
||||
|
||||
if (boost::xtime_cmp(xt, cur) <= 0)
|
||||
{
|
||||
@@ -87,8 +87,8 @@ inline void to_duration(boost::xtime xt, int& milliseconds)
|
||||
{
|
||||
boost::xtime cur;
|
||||
int res = 0;
|
||||
res = boost::xtime_get(&cur, boost::TIME_UTC_);
|
||||
BOOST_ASSERT(res == boost::TIME_UTC_); (void)res;
|
||||
res = boost::xtime_get(&cur, boost::TIME_UTC);
|
||||
BOOST_ASSERT(res == boost::TIME_UTC); (void)res;
|
||||
|
||||
if (boost::xtime_cmp(xt, cur) <= 0)
|
||||
milliseconds = 0;
|
||||
@@ -109,8 +109,8 @@ inline void to_microduration(boost::xtime xt, int& microseconds)
|
||||
{
|
||||
boost::xtime cur;
|
||||
int res = 0;
|
||||
res = boost::xtime_get(&cur, boost::TIME_UTC_);
|
||||
BOOST_ASSERT(res == boost::TIME_UTC_); (void)res;
|
||||
res = boost::xtime_get(&cur, boost::TIME_UTC);
|
||||
BOOST_ASSERT(res == boost::TIME_UTC); (void)res;
|
||||
|
||||
if (boost::xtime_cmp(xt, cur) <= 0)
|
||||
microseconds = 0;
|
||||
|
||||
328
src/shared_mutex.cpp
Normal file
328
src/shared_mutex.cpp
Normal file
@@ -0,0 +1,328 @@
|
||||
// Copyright Howard Hinnant 2007-2010.
|
||||
// Copyright Vicente J. Botet Escriba 2012.
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/thread/v2/shared_mutex.hpp>
|
||||
#include <boost/thread/locks.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace thread_v2
|
||||
{
|
||||
|
||||
// shared_mutex
|
||||
|
||||
shared_mutex::shared_mutex()
|
||||
: state_(0)
|
||||
{
|
||||
}
|
||||
|
||||
shared_mutex::~shared_mutex()
|
||||
{
|
||||
boost::lock_guard<mutex_t> _(mut_);
|
||||
}
|
||||
|
||||
// Exclusive ownership
|
||||
|
||||
void
|
||||
shared_mutex::lock()
|
||||
{
|
||||
boost::unique_lock<mutex_t> lk(mut_);
|
||||
while (state_ & write_entered_)
|
||||
gate1_.wait(lk);
|
||||
state_ |= write_entered_;
|
||||
while (state_ & n_readers_)
|
||||
gate2_.wait(lk);
|
||||
}
|
||||
|
||||
bool
|
||||
shared_mutex::try_lock()
|
||||
{
|
||||
boost::unique_lock<mutex_t> lk(mut_);
|
||||
if (state_ == 0)
|
||||
{
|
||||
state_ = write_entered_;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
shared_mutex::unlock()
|
||||
{
|
||||
boost::lock_guard<mutex_t> _(mut_);
|
||||
state_ = 0;
|
||||
gate1_.notify_all();
|
||||
}
|
||||
|
||||
// Shared ownership
|
||||
|
||||
void
|
||||
shared_mutex::lock_shared()
|
||||
{
|
||||
boost::unique_lock<mutex_t> lk(mut_);
|
||||
while ((state_ & write_entered_) || (state_ & n_readers_) == n_readers_)
|
||||
gate1_.wait(lk);
|
||||
count_t num_readers = (state_ & n_readers_) + 1;
|
||||
state_ &= ~n_readers_;
|
||||
state_ |= num_readers;
|
||||
}
|
||||
|
||||
bool
|
||||
shared_mutex::try_lock_shared()
|
||||
{
|
||||
boost::unique_lock<mutex_t> lk(mut_);
|
||||
count_t num_readers = state_ & n_readers_;
|
||||
if (!(state_ & write_entered_) && num_readers != n_readers_)
|
||||
{
|
||||
++num_readers;
|
||||
state_ &= ~n_readers_;
|
||||
state_ |= num_readers;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
shared_mutex::unlock_shared()
|
||||
{
|
||||
boost::lock_guard<mutex_t> _(mut_);
|
||||
count_t num_readers = (state_ & n_readers_) - 1;
|
||||
state_ &= ~n_readers_;
|
||||
state_ |= num_readers;
|
||||
if (state_ & write_entered_)
|
||||
{
|
||||
if (num_readers == 0)
|
||||
gate2_.notify_one();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num_readers == n_readers_ - 1)
|
||||
gate1_.notify_one();
|
||||
}
|
||||
}
|
||||
|
||||
// upgrade_mutex
|
||||
|
||||
upgrade_mutex::upgrade_mutex()
|
||||
: gate1_(),
|
||||
gate2_(),
|
||||
state_(0)
|
||||
{
|
||||
}
|
||||
|
||||
upgrade_mutex::~upgrade_mutex()
|
||||
{
|
||||
boost::lock_guard<mutex_t> _(mut_);
|
||||
}
|
||||
|
||||
// Exclusive ownership
|
||||
|
||||
void
|
||||
upgrade_mutex::lock()
|
||||
{
|
||||
boost::unique_lock<mutex_t> lk(mut_);
|
||||
while (state_ & (write_entered_ | upgradable_entered_))
|
||||
gate1_.wait(lk);
|
||||
state_ |= write_entered_;
|
||||
while (state_ & n_readers_)
|
||||
gate2_.wait(lk);
|
||||
}
|
||||
|
||||
bool
|
||||
upgrade_mutex::try_lock()
|
||||
{
|
||||
boost::unique_lock<mutex_t> lk(mut_);
|
||||
if (state_ == 0)
|
||||
{
|
||||
state_ = write_entered_;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
upgrade_mutex::unlock()
|
||||
{
|
||||
boost::lock_guard<mutex_t> _(mut_);
|
||||
state_ = 0;
|
||||
gate1_.notify_all();
|
||||
}
|
||||
|
||||
// Shared ownership
|
||||
|
||||
void
|
||||
upgrade_mutex::lock_shared()
|
||||
{
|
||||
boost::unique_lock<mutex_t> lk(mut_);
|
||||
while ((state_ & write_entered_) || (state_ & n_readers_) == n_readers_)
|
||||
gate1_.wait(lk);
|
||||
count_t num_readers = (state_ & n_readers_) + 1;
|
||||
state_ &= ~n_readers_;
|
||||
state_ |= num_readers;
|
||||
}
|
||||
|
||||
bool
|
||||
upgrade_mutex::try_lock_shared()
|
||||
{
|
||||
boost::unique_lock<mutex_t> lk(mut_);
|
||||
count_t num_readers = state_ & n_readers_;
|
||||
if (!(state_ & write_entered_) && num_readers != n_readers_)
|
||||
{
|
||||
++num_readers;
|
||||
state_ &= ~n_readers_;
|
||||
state_ |= num_readers;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
upgrade_mutex::unlock_shared()
|
||||
{
|
||||
boost::lock_guard<mutex_t> _(mut_);
|
||||
count_t num_readers = (state_ & n_readers_) - 1;
|
||||
state_ &= ~n_readers_;
|
||||
state_ |= num_readers;
|
||||
if (state_ & write_entered_)
|
||||
{
|
||||
if (num_readers == 0)
|
||||
gate2_.notify_one();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num_readers == n_readers_ - 1)
|
||||
gate1_.notify_one();
|
||||
}
|
||||
}
|
||||
|
||||
// Upgrade ownership
|
||||
|
||||
void
|
||||
upgrade_mutex::lock_upgrade()
|
||||
{
|
||||
boost::unique_lock<mutex_t> lk(mut_);
|
||||
while ((state_ & (write_entered_ | upgradable_entered_)) ||
|
||||
(state_ & n_readers_) == n_readers_)
|
||||
gate1_.wait(lk);
|
||||
count_t num_readers = (state_ & n_readers_) + 1;
|
||||
state_ &= ~n_readers_;
|
||||
state_ |= upgradable_entered_ | num_readers;
|
||||
}
|
||||
|
||||
bool
|
||||
upgrade_mutex::try_lock_upgrade()
|
||||
{
|
||||
boost::unique_lock<mutex_t> lk(mut_);
|
||||
count_t num_readers = state_ & n_readers_;
|
||||
if (!(state_ & (write_entered_ | upgradable_entered_))
|
||||
&& num_readers != n_readers_)
|
||||
{
|
||||
++num_readers;
|
||||
state_ &= ~n_readers_;
|
||||
state_ |= upgradable_entered_ | num_readers;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
upgrade_mutex::unlock_upgrade()
|
||||
{
|
||||
{
|
||||
boost::lock_guard<mutex_t> _(mut_);
|
||||
count_t num_readers = (state_ & n_readers_) - 1;
|
||||
state_ &= ~(upgradable_entered_ | n_readers_);
|
||||
state_ |= num_readers;
|
||||
}
|
||||
gate1_.notify_all();
|
||||
}
|
||||
|
||||
// Shared <-> Exclusive
|
||||
|
||||
bool
|
||||
upgrade_mutex::try_unlock_shared_and_lock()
|
||||
{
|
||||
boost::unique_lock<mutex_t> lk(mut_);
|
||||
if (state_ == 1)
|
||||
{
|
||||
state_ = write_entered_;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
upgrade_mutex::unlock_and_lock_shared()
|
||||
{
|
||||
{
|
||||
boost::lock_guard<mutex_t> _(mut_);
|
||||
state_ = 1;
|
||||
}
|
||||
gate1_.notify_all();
|
||||
}
|
||||
|
||||
// Shared <-> Upgrade
|
||||
|
||||
bool
|
||||
upgrade_mutex::try_unlock_shared_and_lock_upgrade()
|
||||
{
|
||||
boost::unique_lock<mutex_t> lk(mut_);
|
||||
if (!(state_ & (write_entered_ | upgradable_entered_)))
|
||||
{
|
||||
state_ |= upgradable_entered_;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
upgrade_mutex::unlock_upgrade_and_lock_shared()
|
||||
{
|
||||
{
|
||||
boost::lock_guard<mutex_t> _(mut_);
|
||||
state_ &= ~upgradable_entered_;
|
||||
}
|
||||
gate1_.notify_all();
|
||||
}
|
||||
|
||||
// Upgrade <-> Exclusive
|
||||
|
||||
void
|
||||
upgrade_mutex::unlock_upgrade_and_lock()
|
||||
{
|
||||
boost::unique_lock<mutex_t> lk(mut_);
|
||||
count_t num_readers = (state_ & n_readers_) - 1;
|
||||
state_ &= ~(upgradable_entered_ | n_readers_);
|
||||
state_ |= write_entered_ | num_readers;
|
||||
while (state_ & n_readers_)
|
||||
gate2_.wait(lk);
|
||||
}
|
||||
|
||||
bool
|
||||
upgrade_mutex::try_unlock_upgrade_and_lock()
|
||||
{
|
||||
boost::unique_lock<mutex_t> lk(mut_);
|
||||
if (state_ == (upgradable_entered_ | 1))
|
||||
{
|
||||
state_ = write_entered_;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
upgrade_mutex::unlock_and_lock_upgrade()
|
||||
{
|
||||
{
|
||||
boost::lock_guard<mutex_t> _(mut_);
|
||||
state_ = upgradable_entered_ | 1;
|
||||
}
|
||||
gate1_.notify_all();
|
||||
}
|
||||
|
||||
} // thread_v2
|
||||
} // boost
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#if defined(BOOST_HAS_WINTHREADS) && (defined(BOOST_THREAD_BUILD_LIB) || defined(BOOST_THREAD_TEST) || defined(UNDER_CE)) && (!defined(_MSC_VER) || defined(UNDER_CE))
|
||||
|
||||
namespace boost
|
||||
namespace boost
|
||||
{
|
||||
/*
|
||||
This file is a "null" implementation of tss cleanup; it's
|
||||
@@ -32,7 +32,7 @@ namespace boost
|
||||
longer needed and can be removed.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif //defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_LIB) && !defined(_MSC_VER)
|
||||
|
||||
@@ -4,48 +4,26 @@
|
||||
// (C) Copyright 2007 Anthony Williams
|
||||
// (C) Copyright 2007 David Deakins
|
||||
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x400
|
||||
#endif
|
||||
|
||||
#ifndef WINVER
|
||||
#define WINVER 0x400
|
||||
#endif
|
||||
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <boost/thread/once.hpp>
|
||||
#include <boost/thread/tss.hpp>
|
||||
#include <boost/thread/condition_variable.hpp>
|
||||
#include <boost/thread/detail/tss_hooks.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/date_time/posix_time/conversion.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
#ifndef UNDER_CE
|
||||
#include <process.h>
|
||||
#endif
|
||||
#include <stdio.h>
|
||||
#include <boost/thread/once.hpp>
|
||||
#include <boost/thread/tss.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/thread/detail/tss_hooks.hpp>
|
||||
#include <boost/date_time/posix_time/conversion.hpp>
|
||||
#include <windows.h>
|
||||
#include <memory>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
thread_data_base::~thread_data_base()
|
||||
{
|
||||
{
|
||||
for (notify_list_t::iterator i = notify.begin(), e = notify.end();
|
||||
i != e; ++i)
|
||||
{
|
||||
i->second->unlock();
|
||||
i->first->notify_all();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
namespace
|
||||
{
|
||||
#ifdef BOOST_THREAD_PROVIDES_ONCE_CXX11
|
||||
@@ -53,31 +31,33 @@ namespace boost
|
||||
#else
|
||||
boost::once_flag current_thread_tls_init_flag=BOOST_ONCE_INIT;
|
||||
#endif
|
||||
#if defined(UNDER_CE)
|
||||
#if defined(UNDER_CE)
|
||||
// Windows CE does not define the TLS_OUT_OF_INDEXES constant.
|
||||
#define TLS_OUT_OF_INDEXES 0xFFFFFFFF
|
||||
#endif
|
||||
DWORD current_thread_tls_key=TLS_OUT_OF_INDEXES;
|
||||
DWORD tls_out_of_index=0xFFFFFFFF;
|
||||
#else
|
||||
DWORD tls_out_of_index=TLS_OUT_OF_INDEXES;
|
||||
#endif
|
||||
DWORD current_thread_tls_key=tls_out_of_index;
|
||||
|
||||
void create_current_thread_tls_key()
|
||||
{
|
||||
tss_cleanup_implemented(); // if anyone uses TSS, we need the cleanup linked in
|
||||
current_thread_tls_key=TlsAlloc();
|
||||
BOOST_ASSERT(current_thread_tls_key!=TLS_OUT_OF_INDEXES);
|
||||
BOOST_ASSERT(current_thread_tls_key!=tls_out_of_index);
|
||||
}
|
||||
|
||||
void cleanup_tls_key()
|
||||
{
|
||||
if(current_thread_tls_key!=TLS_OUT_OF_INDEXES)
|
||||
if(current_thread_tls_key!=tls_out_of_index)
|
||||
{
|
||||
TlsFree(current_thread_tls_key);
|
||||
current_thread_tls_key=TLS_OUT_OF_INDEXES;
|
||||
current_thread_tls_key=tls_out_of_index;
|
||||
}
|
||||
}
|
||||
|
||||
detail::thread_data_base* get_current_thread_data()
|
||||
{
|
||||
if(current_thread_tls_key==TLS_OUT_OF_INDEXES)
|
||||
if(current_thread_tls_key==tls_out_of_index)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -87,7 +67,7 @@ namespace boost
|
||||
void set_current_thread_data(detail::thread_data_base* new_data)
|
||||
{
|
||||
boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key);
|
||||
if(current_thread_tls_key!=TLS_OUT_OF_INDEXES)
|
||||
if(current_thread_tls_key!=tls_out_of_index)
|
||||
BOOST_VERIFY(TlsSetValue(current_thread_tls_key,new_data));
|
||||
else
|
||||
boost::throw_exception(thread_resource_error());
|
||||
@@ -145,6 +125,19 @@ namespace boost
|
||||
{}
|
||||
};
|
||||
|
||||
struct tss_data_node
|
||||
{
|
||||
void const* key;
|
||||
boost::shared_ptr<boost::detail::tss_cleanup_function> func;
|
||||
void* value;
|
||||
tss_data_node* next;
|
||||
|
||||
tss_data_node(void const* key_,boost::shared_ptr<boost::detail::tss_cleanup_function> func_,void* value_,
|
||||
tss_data_node* next_):
|
||||
key(key_),func(func_),value(value_),next(next_)
|
||||
{}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace
|
||||
@@ -154,7 +147,7 @@ namespace boost
|
||||
detail::thread_data_ptr current_thread_data(get_current_thread_data(),false);
|
||||
if(current_thread_data)
|
||||
{
|
||||
while(! current_thread_data->tss_data.empty() || current_thread_data->thread_exit_callbacks)
|
||||
while(current_thread_data->tss_data || current_thread_data->thread_exit_callbacks)
|
||||
{
|
||||
while(current_thread_data->thread_exit_callbacks)
|
||||
{
|
||||
@@ -167,18 +160,15 @@ namespace boost
|
||||
}
|
||||
boost::detail::heap_delete(current_node);
|
||||
}
|
||||
for(std::map<void const*,detail::tss_data_node>::iterator next=current_thread_data->tss_data.begin(),
|
||||
current,
|
||||
end=current_thread_data->tss_data.end();
|
||||
next!=end;)
|
||||
while(current_thread_data->tss_data)
|
||||
{
|
||||
current=next;
|
||||
++next;
|
||||
if(current->second.func && (current->second.value!=0))
|
||||
detail::tss_data_node* const current_node=current_thread_data->tss_data;
|
||||
current_thread_data->tss_data=current_node->next;
|
||||
if(current_node->func)
|
||||
{
|
||||
(*current->second.func)(current->second.value);
|
||||
(*current_node->func)(current_node->value);
|
||||
}
|
||||
current_thread_data->tss_data.erase(current);
|
||||
boost::detail::heap_delete(current_node);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,20 +180,16 @@ namespace boost
|
||||
{
|
||||
detail::thread_data_base* const thread_info(reinterpret_cast<detail::thread_data_base*>(param));
|
||||
set_current_thread_data(thread_info);
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try // BOOST_NO_EXCEPTIONS protected
|
||||
#endif
|
||||
try
|
||||
{
|
||||
thread_info->run();
|
||||
}
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
catch(thread_interrupted const&) // BOOST_NO_EXCEPTIONS protected
|
||||
catch(thread_interrupted const&)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
// Removed as it stops the debugger identifying the cause of the exception
|
||||
// Unhandled exceptions still cause the application to terminate
|
||||
// catch(...) // BOOST_NO_EXCEPTIONS protected
|
||||
// catch(...)
|
||||
// {
|
||||
// std::terminate();
|
||||
// }
|
||||
@@ -230,7 +216,7 @@ namespace boost
|
||||
void thread::start_thread(const attributes& attr)
|
||||
{
|
||||
//uintptr_t const new_thread=_beginthreadex(attr.get_security(),attr.get_stack_size(),&thread_start_function,thread_info.get(),CREATE_SUSPENDED,&thread_info->id);
|
||||
uintptr_t const new_thread=_beginthreadex(0,static_cast<unsigned int>(attr.get_stack_size()),&thread_start_function,thread_info.get(),CREATE_SUSPENDED,&thread_info->id);
|
||||
uintptr_t const new_thread=_beginthreadex(0,attr.get_stack_size(),&thread_start_function,thread_info.get(),CREATE_SUSPENDED,&thread_info->id);
|
||||
if(!new_thread)
|
||||
{
|
||||
boost::throw_exception(thread_resource_error());
|
||||
@@ -257,9 +243,6 @@ namespace boost
|
||||
|
||||
void run()
|
||||
{}
|
||||
void notify_all_at_thread_exit(condition_variable*, mutex*)
|
||||
{}
|
||||
|
||||
private:
|
||||
externally_launched_thread(externally_launched_thread&);
|
||||
void operator=(externally_launched_thread&);
|
||||
@@ -268,19 +251,15 @@ namespace boost
|
||||
void make_external_thread_data()
|
||||
{
|
||||
externally_launched_thread* me=detail::heap_new<externally_launched_thread>();
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try // BOOST_NO_EXCEPTIONS protected
|
||||
#endif
|
||||
try
|
||||
{
|
||||
set_current_thread_data(me);
|
||||
}
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
catch(...) // BOOST_NO_EXCEPTIONS protected
|
||||
catch(...)
|
||||
{
|
||||
detail::heap_delete(me);
|
||||
throw; // BOOST_NO_EXCEPTIONS protected
|
||||
throw;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
detail::thread_data_base* get_or_make_current_thread_data()
|
||||
@@ -311,6 +290,7 @@ namespace boost
|
||||
{
|
||||
return (get_thread_info)();
|
||||
}
|
||||
|
||||
void thread::join()
|
||||
{
|
||||
if (this_thread::get_id() == get_id())
|
||||
@@ -323,44 +303,50 @@ namespace boost
|
||||
this_thread::interruptible_wait(local_thread_info->thread_handle,detail::timeout::sentinel());
|
||||
release_handle();
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED
|
||||
boost::throw_exception(thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable"));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
bool thread::timed_join(boost::system_time const& wait_until)
|
||||
{
|
||||
return do_try_join_until(get_milliseconds_until(wait_until));
|
||||
if (this_thread::get_id() == get_id())
|
||||
{
|
||||
boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself"));
|
||||
}
|
||||
detail::thread_data_ptr local_thread_info=(get_thread_info)();
|
||||
if(local_thread_info)
|
||||
{
|
||||
if(!this_thread::interruptible_wait(local_thread_info->thread_handle,get_milliseconds_until(wait_until)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
release_handle();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool thread::do_try_join_until(uintmax_t milli)
|
||||
#ifdef BOOST_THREAD_USES_CHRONO
|
||||
|
||||
bool thread::try_join_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>& tp)
|
||||
{
|
||||
if (this_thread::get_id() == get_id())
|
||||
{
|
||||
boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself"));
|
||||
boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself"));
|
||||
}
|
||||
detail::thread_data_ptr local_thread_info=(get_thread_info)();
|
||||
if(local_thread_info)
|
||||
{
|
||||
if(!this_thread::interruptible_wait(local_thread_info->thread_handle,milli))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
release_handle();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED
|
||||
boost::throw_exception(thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable"));
|
||||
#endif
|
||||
chrono::milliseconds rel_time= chrono::ceil<chrono::milliseconds>(tp-chrono::system_clock::now());
|
||||
if(!this_thread::interruptible_wait(local_thread_info->thread_handle,rel_time.count()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
release_handle();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void thread::detach()
|
||||
#endif
|
||||
|
||||
void thread::detach() BOOST_NOEXCEPT
|
||||
{
|
||||
release_handle();
|
||||
}
|
||||
@@ -639,11 +625,14 @@ namespace boost
|
||||
detail::thread_data_base* const current_thread_data(get_current_thread_data());
|
||||
if(current_thread_data)
|
||||
{
|
||||
std::map<void const*,tss_data_node>::iterator current_node=
|
||||
current_thread_data->tss_data.find(key);
|
||||
if(current_node!=current_thread_data->tss_data.end())
|
||||
detail::tss_data_node* current_node=current_thread_data->tss_data;
|
||||
while(current_node)
|
||||
{
|
||||
return ¤t_node->second;
|
||||
if(current_node->key==key)
|
||||
{
|
||||
return current_node;
|
||||
}
|
||||
current_node=current_node->next;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@@ -658,43 +647,23 @@ namespace boost
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void add_new_tss_node(void const* key,
|
||||
boost::shared_ptr<tss_cleanup_function> func,
|
||||
void* tss_data)
|
||||
{
|
||||
detail::thread_data_base* const current_thread_data(get_or_make_current_thread_data());
|
||||
current_thread_data->tss_data.insert(std::make_pair(key,tss_data_node(func,tss_data)));
|
||||
}
|
||||
|
||||
void erase_tss_node(void const* key)
|
||||
{
|
||||
detail::thread_data_base* const current_thread_data(get_or_make_current_thread_data());
|
||||
current_thread_data->tss_data.erase(key);
|
||||
}
|
||||
|
||||
void set_tss_data(void const* key,
|
||||
boost::shared_ptr<tss_cleanup_function> func,
|
||||
void* tss_data,bool cleanup_existing)
|
||||
void set_tss_data(void const* key,boost::shared_ptr<tss_cleanup_function> func,void* tss_data,bool cleanup_existing)
|
||||
{
|
||||
if(tss_data_node* const current_node=find_tss_data(key))
|
||||
{
|
||||
if(cleanup_existing && current_node->func && (current_node->value!=0))
|
||||
if(cleanup_existing && current_node->func.get() && current_node->value)
|
||||
{
|
||||
(*current_node->func)(current_node->value);
|
||||
}
|
||||
if(func || (tss_data!=0))
|
||||
{
|
||||
current_node->func=func;
|
||||
current_node->value=tss_data;
|
||||
}
|
||||
else
|
||||
{
|
||||
erase_tss_node(key);
|
||||
}
|
||||
current_node->func=func;
|
||||
current_node->value=tss_data;
|
||||
}
|
||||
else if(func || (tss_data!=0))
|
||||
else if(func && tss_data)
|
||||
{
|
||||
add_new_tss_node(key,func,tss_data);
|
||||
detail::thread_data_base* const current_thread_data(get_or_make_current_thread_data());
|
||||
tss_data_node* const new_node=
|
||||
heap_new<tss_data_node>(key,func,tss_data,current_thread_data->tss_data);
|
||||
current_thread_data->tss_data=new_node;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -714,14 +683,6 @@ namespace boost
|
||||
boost::run_thread_exit_callbacks();
|
||||
}
|
||||
|
||||
BOOST_THREAD_DECL void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk)
|
||||
{
|
||||
detail::thread_data_base* const current_thread_data(get_current_thread_data());
|
||||
if(current_thread_data)
|
||||
{
|
||||
current_thread_data->notify_all_at_thread_exit(&cond, lk.release());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ const int NANOSECONDS_PER_MICROSECOND = 1000;
|
||||
inline void to_time(int milliseconds, boost::xtime& xt)
|
||||
{
|
||||
int res = 0;
|
||||
res = boost::xtime_get(&xt, boost::TIME_UTC_);
|
||||
assert(res == boost::TIME_UTC_);
|
||||
res = boost::xtime_get(&xt, boost::TIME_UTC);
|
||||
assert(res == boost::TIME_UTC);
|
||||
|
||||
xt.sec += (milliseconds / MILLISECONDS_PER_SECOND);
|
||||
xt.nsec += ((milliseconds % MILLISECONDS_PER_SECOND) *
|
||||
@@ -54,8 +54,8 @@ inline void to_timespec_duration(const boost::xtime& xt, timespec& ts)
|
||||
{
|
||||
boost::xtime cur;
|
||||
int res = 0;
|
||||
res = boost::xtime_get(&cur, boost::TIME_UTC_);
|
||||
assert(res == boost::TIME_UTC_);
|
||||
res = boost::xtime_get(&cur, boost::TIME_UTC);
|
||||
assert(res == boost::TIME_UTC);
|
||||
|
||||
if (boost::xtime_cmp(xt, cur) <= 0)
|
||||
{
|
||||
@@ -85,8 +85,8 @@ inline void to_duration(boost::xtime xt, int& milliseconds)
|
||||
{
|
||||
boost::xtime cur;
|
||||
int res = 0;
|
||||
res = boost::xtime_get(&cur, boost::TIME_UTC_);
|
||||
assert(res == boost::TIME_UTC_);
|
||||
res = boost::xtime_get(&cur, boost::TIME_UTC);
|
||||
assert(res == boost::TIME_UTC);
|
||||
|
||||
if (boost::xtime_cmp(xt, cur) <= 0)
|
||||
milliseconds = 0;
|
||||
@@ -107,8 +107,8 @@ inline void to_microduration(boost::xtime xt, int& microseconds)
|
||||
{
|
||||
boost::xtime cur;
|
||||
int res = 0;
|
||||
res = boost::xtime_get(&cur, boost::TIME_UTC_);
|
||||
assert(res == boost::TIME_UTC_);
|
||||
res = boost::xtime_get(&cur, boost::TIME_UTC);
|
||||
assert(res == boost::TIME_UTC);
|
||||
|
||||
if (boost::xtime_cmp(xt, cur) <= 0)
|
||||
microseconds = 0;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include <boost/thread/detail/config.hpp>
|
||||
|
||||
|
||||
#if defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_DLL)
|
||||
|
||||
#include <boost/thread/detail/tss_hooks.hpp>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
#if defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_LIB)
|
||||
|
||||
#if (defined(__MINGW32__) && !defined(_WIN64)) || defined(__MINGW64__) || (__MINGW64_VERSION_MAJOR)
|
||||
#if (defined(__MINGW32__) && !defined(_WIN64)) || defined(__MINGW64__)
|
||||
|
||||
#include <boost/thread/detail/tss_hooks.hpp>
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__MINGW64__) || (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION >3) || \
|
||||
#if defined(__MINGW64__) || (__MINGW32_MAJOR_VERSION >3) || \
|
||||
((__MINGW32_MAJOR_VERSION==3) && (__MINGW32_MINOR_VERSION>=18))
|
||||
extern "C"
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ project
|
||||
<toolset>clang:<cxxflags>-pedantic
|
||||
<toolset>clang:<cxxflags>-Wno-long-long
|
||||
<toolset>clang:<cxxflags>-ansi
|
||||
#<toolset>clang:<cxxflags>-fpermissive # doesn't work
|
||||
#<toolset>clang:<cxxflags>-fpermissive # doesn't work
|
||||
|
||||
<toolset>gcc-mingw-4.4.0:<cxxflags>-fdiagnostics-show-option
|
||||
<toolset>gcc-mingw-4.5.0:<cxxflags>-fdiagnostics-show-option
|
||||
@@ -80,14 +80,9 @@ rule thread-run ( sources )
|
||||
rule thread-test ( sources )
|
||||
{
|
||||
return
|
||||
[ run $(sources) ../build//boost_thread : : :
|
||||
<library>/boost/test//boost_unit_test_framework/<link>static
|
||||
]
|
||||
[ run $(sources) ../build//boost_thread : : : <library>/boost/test//boost_unit_test_framework/<link>static ]
|
||||
[ run $(sources) ../src/tss_null.cpp ../build//boost_thread/<link>static
|
||||
: : :
|
||||
<library>/boost/test//boost_unit_test_framework/<link>static
|
||||
: $(sources[1]:B)_lib
|
||||
]
|
||||
: : : <library>/boost/test//boost_unit_test_framework/<link>static : $(sources[1]:B)_lib ]
|
||||
;
|
||||
}
|
||||
|
||||
@@ -165,7 +160,6 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
#[ thread-test test_vhh_shared_mutex_timed_locks.cpp ]
|
||||
;
|
||||
|
||||
#explicit t_futures ;
|
||||
test-suite t_futures
|
||||
:
|
||||
[ thread-test test_futures.cpp ]
|
||||
@@ -178,7 +172,6 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-test test_2309.cpp ]
|
||||
[ thread-run test_2501.cpp ]
|
||||
[ thread-test test_2741.cpp ]
|
||||
[ thread-run test_3628.cpp ]
|
||||
[ thread-run test_4521.cpp ]
|
||||
[ thread-run test_4648.cpp ]
|
||||
[ thread-run test_4882.cpp ]
|
||||
@@ -189,8 +182,6 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run test_6130.cpp ]
|
||||
[ thread-run test_6170.cpp ]
|
||||
[ thread-run test_6174.cpp ]
|
||||
[ thread-run test_7160.cpp ]
|
||||
[ thread-run test_7328.cpp ]
|
||||
;
|
||||
|
||||
|
||||
@@ -203,7 +194,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
|
||||
|
||||
|
||||
#explicit ts_conditions ;
|
||||
#explicit conditions ;
|
||||
test-suite ts_conditions
|
||||
:
|
||||
[ thread-compile-fail ./sync/conditions/condition_variable/assign_fail.cpp : : condition_variable__assign_f ]
|
||||
@@ -225,16 +216,15 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/conditions/condition_variable_any/wait_until_pass.cpp : condition_variable_any__wait_until_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable_any/wait_until_pred_pass.cpp : condition_variable_any__wait_until_pred_p ]
|
||||
[ thread-run2 ./sync/conditions/cv_status/cv_status_pass.cpp : cv_status__cv_status_p ]
|
||||
[ thread-run2 ./sync/conditions/notify_all_at_thread_exit_pass.cpp : notify_all_at_thread_exit_p ]
|
||||
;
|
||||
|
||||
explicit ts_async ;
|
||||
#explicit async ;
|
||||
test-suite ts_async
|
||||
:
|
||||
[ thread-run2 ./sync/futures/async/async_pass.cpp : async__async_p ]
|
||||
# [ thread-run2 ./sync/futures/async/async_pass.cpp : async__async_p ]
|
||||
;
|
||||
|
||||
#explicit ts_promise ;
|
||||
#explicit promise ;
|
||||
test-suite ts_promise
|
||||
:
|
||||
[ thread-compile-fail ./sync/futures/promise/copy_assign_fail.cpp : : promise__copy_assign_f ]
|
||||
@@ -248,7 +238,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/futures/promise/use_allocator_pass.cpp : promise__use_allocator_p ]
|
||||
;
|
||||
|
||||
#explicit ts_future ;
|
||||
#explicit future ;
|
||||
test-suite ts_future
|
||||
:
|
||||
[ thread-compile-fail ./sync/futures/future/copy_assign_fail.cpp : : future__copy_assign_f ]
|
||||
@@ -261,7 +251,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/futures/future/share_pass.cpp : future__share_p ]
|
||||
;
|
||||
|
||||
#explicit ts_packaged_task ;
|
||||
#explicit packaged_task ;
|
||||
test-suite ts_packaged_task
|
||||
:
|
||||
[ thread-run2 ./sync/futures/packaged_task/alloc_ctor_pass.cpp : packaged_task__alloc_ctor_p ]
|
||||
@@ -282,7 +272,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
;
|
||||
|
||||
|
||||
#explicit ts_lock_guard ;
|
||||
#explicit lock_guard ;
|
||||
test-suite ts_lock_guard
|
||||
:
|
||||
[ thread-compile-fail ./sync/mutual_exclusion/locks/lock_guard/copy_assign_fail.cpp : : lock_guard__cons__copy_assign_f ]
|
||||
@@ -292,7 +282,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/lock_guard/types_pass.cpp : lock_guard__types_p ]
|
||||
;
|
||||
|
||||
#explicit ts_unique_lock ;
|
||||
#explicit unique_lock ;
|
||||
test-suite ts_unique_lock
|
||||
:
|
||||
[ thread-compile-fail ./sync/mutual_exclusion/locks/unique_lock/cons/copy_assign_fail.cpp : : unique_lock__cons__copy_assign_f ]
|
||||
@@ -325,7 +315,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/types_pass.cpp : unique_lock__types_p ]
|
||||
;
|
||||
|
||||
#explicit ts_shared_lock ;
|
||||
#explicit shared_lock ;
|
||||
test-suite ts_shared_lock
|
||||
:
|
||||
[ thread-compile-fail ./sync/mutual_exclusion/locks/shared_lock/cons/copy_assign_fail.cpp : : shared_lock__cons__copy_assign_f ]
|
||||
@@ -355,7 +345,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/types_pass.cpp : shared_lock__types_p ]
|
||||
;
|
||||
|
||||
#explicit ts_upgrade_lock ;
|
||||
#explicit upgrade_lock ;
|
||||
test-suite ts_upgrade_lock
|
||||
:
|
||||
[ thread-compile-fail ./sync/mutual_exclusion/locks/upgrade_lock/cons/copy_assign_fail.cpp : : upgrade_lock__cons__copy_assign_f ]
|
||||
@@ -384,7 +374,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/types_pass.cpp : upgrade_lock__types_p ]
|
||||
;
|
||||
|
||||
#explicit ts_mutex ;
|
||||
#explicit mutexs ;
|
||||
test-suite ts_mutex
|
||||
:
|
||||
[ thread-compile-fail ./sync/mutual_exclusion/mutex/assign_fail.cpp : : mutex__assign_f ]
|
||||
@@ -395,7 +385,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/mutual_exclusion/mutex/try_lock_pass.cpp : mutex__try_lock_p ]
|
||||
;
|
||||
|
||||
#explicit ts_recursive_mutex ;
|
||||
#explicit recursive_mutex ;
|
||||
test-suite ts_recursive_mutex
|
||||
:
|
||||
[ thread-compile-fail ./sync/mutual_exclusion/recursive_mutex/assign_fail.cpp : : recursive_mutex__assign_f ]
|
||||
@@ -406,7 +396,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/mutual_exclusion/recursive_mutex/try_lock_pass.cpp : recursive_mutex__try_lock_p ]
|
||||
;
|
||||
|
||||
#explicit ts_recursive_timed_mutex ;
|
||||
#explicit recursive_timed_mutex ;
|
||||
test-suite ts_recursive_timed_mutex
|
||||
:
|
||||
[ thread-compile-fail ./sync/mutual_exclusion/recursive_timed_mutex/assign_fail.cpp : : recursive_timed_mutex__assign_f ]
|
||||
@@ -419,7 +409,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/mutual_exclusion/recursive_timed_mutex/try_lock_until_pass.cpp : recursive_timed_mutex__try_lock_until_p ]
|
||||
;
|
||||
|
||||
#explicit ts_timed_mutex ;
|
||||
#explicit timed_mutex ;
|
||||
test-suite ts_timed_mutex
|
||||
:
|
||||
[ thread-compile-fail ./sync/mutual_exclusion/timed_mutex/assign_fail.cpp : : timed_mutex__assign_f ]
|
||||
@@ -432,7 +422,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/mutual_exclusion/timed_mutex/try_lock_until_pass.cpp : timed_mutex__try_lock_until_p ]
|
||||
;
|
||||
|
||||
#explicit ts_shared_mutex ;
|
||||
#explicit shared_mutexs ;
|
||||
test-suite ts_shared_mutex
|
||||
:
|
||||
[ thread-compile-fail ./sync/mutual_exclusion/shared_mutex/assign_fail.cpp : : shared_mutex__assign_f ]
|
||||
@@ -445,7 +435,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
|
||||
;
|
||||
|
||||
#explicit ts_this_thread ;
|
||||
#explicit this_thread ;
|
||||
test-suite ts_this_thread
|
||||
:
|
||||
[ thread-run2 ./threads/this_thread/get_id/get_id_pass.cpp : this_thread__get_id_p ]
|
||||
@@ -453,7 +443,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./threads/this_thread/sleep_until/sleep_until_pass.cpp : this_thread__sleep_until_p ]
|
||||
;
|
||||
|
||||
#explicit ts_thread ;
|
||||
#explicit thread ;
|
||||
test-suite ts_thread
|
||||
:
|
||||
[ thread-compile-fail ./threads/thread/assign/copy_fail.cpp : : thread__assign__copy_f ]
|
||||
@@ -470,8 +460,6 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./threads/thread/members/detach_pass.cpp : thread__detach_p ]
|
||||
[ thread-run2 ./threads/thread/members/get_id_pass.cpp : thread__get_id_p ]
|
||||
[ thread-run2 ./threads/thread/members/join_pass.cpp : thread__join_p ]
|
||||
[ thread-run2 ./threads/thread/members/try_join_until_pass.cpp : thread__join_until_p ]
|
||||
[ thread-run2 ./threads/thread/members/try_join_for_pass.cpp : thread__join_for_p ]
|
||||
[ thread-run2 ./threads/thread/members/joinable_pass.cpp : thread__joinable_p ]
|
||||
[ thread-run2 ./threads/thread/members/native_handle_pass.cpp : thread__native_handle_p ]
|
||||
[ thread-run2 ./threads/thread/members/swap_pass.cpp : thread__swap_p ]
|
||||
@@ -486,7 +474,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./threads/container/thread_ptr_list_pass.cpp : container__thread_ptr_list_p ]
|
||||
;
|
||||
|
||||
#explicit ts_examples ;
|
||||
#explicit examples ;
|
||||
test-suite ts_examples
|
||||
:
|
||||
[ thread-run ../example/monitor.cpp ]
|
||||
@@ -506,7 +494,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
#[ thread-run ../example/vhh_shared_mutex.cpp ]
|
||||
;
|
||||
|
||||
#explicit ts_shared_upwards ;
|
||||
#explicit shared_upwards ;
|
||||
test-suite ts_shared_upwards
|
||||
:
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_ctor_shared_lock_try_pass.cpp : unique_lock__cons__move_ctor_shared_lock_try_p ]
|
||||
@@ -519,7 +507,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
;
|
||||
|
||||
|
||||
#explicit ts_shared_lock_guard ;
|
||||
#explicit shared_lock_guard ;
|
||||
test-suite ts_shared_lock_guard
|
||||
:
|
||||
[ thread-compile-fail ./sync/mutual_exclusion/locks/shared_lock_guard/copy_assign_fail.cpp : : shared_lock_guard__cons__copy_assign_f ]
|
||||
@@ -529,7 +517,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/shared_lock_guard/types_pass.cpp : shared_lock_guard__types_p ]
|
||||
;
|
||||
|
||||
#explicit ts_reverse_lock ;
|
||||
#explicit reverse_lock ;
|
||||
test-suite ts_reverse_lock
|
||||
:
|
||||
[ thread-compile-fail ./sync/mutual_exclusion/locks/reverse_lock/copy_assign_fail.cpp : : reverse_lock__copy_assign_f ]
|
||||
@@ -538,4 +526,10 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/mutual_exclusion/locks/reverse_lock/types_pass.cpp : reverse_lock__types_p ]
|
||||
;
|
||||
|
||||
explicit ts ;
|
||||
test-suite ts
|
||||
:
|
||||
[ thread-run test_ml.cpp ]
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
@@ -14,4 +14,14 @@ void test()
|
||||
t2=t1;
|
||||
}
|
||||
|
||||
#include "./remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
|
||||
}
|
||||
|
||||
@@ -13,4 +13,14 @@ void test()
|
||||
boost::thread t2(t1);
|
||||
}
|
||||
|
||||
#include "./remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
// Copyright (C) 2008 Anthony Williams
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#include <boost/thread/thread.hpp>
|
||||
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: 'boost::system::posix_category' defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: 'boost::system::errno_ecat' defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: 'boost::system::native_ecat' defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
|
||||
}
|
||||
@@ -27,5 +27,13 @@ void fail()
|
||||
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -26,5 +26,13 @@ void fail()
|
||||
boost::condition_variable cv1(cv0);
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -26,5 +26,13 @@ void fail()
|
||||
cv1 = cv0;
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -26,5 +26,13 @@ void fail()
|
||||
boost::condition_variable_any cv1(cv0);
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
// Copyright (C) 2011 Vicente J. Botet Escriba
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// <boost/thread/condition_variable.hpp>
|
||||
|
||||
// void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
|
||||
#define BOOST_THREAD_USES_MOVE
|
||||
#define BOOST_THREAD_VESRION 3
|
||||
|
||||
#include <boost/thread/condition_variable.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <boost/chrono/chrono.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
boost::condition_variable cv;
|
||||
boost::mutex mut;
|
||||
|
||||
typedef boost::chrono::milliseconds ms;
|
||||
typedef boost::chrono::high_resolution_clock Clock;
|
||||
|
||||
void func()
|
||||
{
|
||||
boost::unique_lock < boost::mutex > lk(mut);
|
||||
boost::notify_all_at_thread_exit(cv, boost::move(lk));
|
||||
boost::this_thread::sleep_for(ms(300));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::unique_lock < boost::mutex > lk(mut);
|
||||
boost::thread(func).detach();
|
||||
Clock::time_point t0 = Clock::now();
|
||||
cv.wait(lk);
|
||||
Clock::time_point t1 = Clock::now();
|
||||
BOOST_TEST(t1 - t0 > ms(250));
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -22,52 +22,14 @@
|
||||
// future<typename result_of<F(Args...)>::type>
|
||||
// async(launch policy, F&& f, Args&&... args);
|
||||
|
||||
#define BOOST_THREAD_VERSION 3
|
||||
|
||||
#include <boost/thread/future.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <boost/interprocess/smart_ptr/unique_ptr.hpp>
|
||||
#include <memory>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
typedef boost::chrono::high_resolution_clock Clock;
|
||||
typedef boost::chrono::milliseconds ms;
|
||||
|
||||
class A
|
||||
{
|
||||
long data_;
|
||||
|
||||
public:
|
||||
typedef int result_type;
|
||||
|
||||
explicit A(long i) : data_(i) {}
|
||||
|
||||
long operator()() const
|
||||
{
|
||||
boost::this_thread::sleep_for(ms(200));
|
||||
return data_;
|
||||
}
|
||||
};
|
||||
|
||||
class MoveOnly
|
||||
{
|
||||
public:
|
||||
typedef int result_type;
|
||||
|
||||
BOOST_THREAD_MOVABLE_ONLY(MoveOnly)
|
||||
MoveOnly()
|
||||
{
|
||||
}
|
||||
MoveOnly(BOOST_THREAD_RV_REF(MoveOnly))
|
||||
{}
|
||||
|
||||
int operator()()
|
||||
{
|
||||
boost::this_thread::sleep_for(ms(200));
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
int f0()
|
||||
{
|
||||
boost::this_thread::sleep_for(ms(200));
|
||||
@@ -87,21 +49,18 @@ void f2()
|
||||
boost::this_thread::sleep_for(ms(200));
|
||||
}
|
||||
|
||||
boost::interprocess::unique_ptr<int, boost::default_delete<int> > f3(int i)
|
||||
boost::unique_ptr<int> f3(int i)
|
||||
{
|
||||
boost::this_thread::sleep_for(ms(200));
|
||||
return boost::interprocess::unique_ptr<int, boost::default_delete<int> >(new int(i));
|
||||
return boost::unique_ptr<int>(new int(i));
|
||||
}
|
||||
|
||||
typedef boost::interprocess::unique_ptr<int, boost::default_delete<int> > XXT;
|
||||
boost::interprocess::unique_ptr<int, boost::default_delete<int> > f4(
|
||||
BOOST_THREAD_RV_REF(boost::interprocess::unique_ptr<int, boost::default_delete<int> > ) p)
|
||||
boost::unique_ptr<int> f4(boost::unique_ptr<int>&& p)
|
||||
{
|
||||
boost::this_thread::sleep_for(ms(200));
|
||||
return boost::move(p);
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
@@ -120,22 +79,6 @@ int main()
|
||||
Clock::time_point t1 = Clock::now();
|
||||
BOOST_TEST(t1 - t0 < ms(100));
|
||||
}
|
||||
{
|
||||
boost::future<int> f = boost::async(boost::launch::async, A(3));
|
||||
boost::this_thread::sleep_for(ms(300));
|
||||
Clock::time_point t0 = Clock::now();
|
||||
BOOST_TEST(f.get() == 3);
|
||||
Clock::time_point t1 = Clock::now();
|
||||
BOOST_TEST(t1 - t0 < ms(100));
|
||||
}
|
||||
{
|
||||
boost::future<int> f = boost::async(boost::launch::async, BOOST_THREAD_MAKE_RV_REF(MoveOnly()));
|
||||
boost::this_thread::sleep_for(ms(300));
|
||||
Clock::time_point t0 = Clock::now();
|
||||
BOOST_TEST(f.get() == 3);
|
||||
Clock::time_point t1 = Clock::now();
|
||||
BOOST_TEST(t1 - t0 < ms(100));
|
||||
}
|
||||
{
|
||||
boost::future<int> f = boost::async(boost::launch::any, f0);
|
||||
boost::this_thread::sleep_for(ms(300));
|
||||
@@ -144,15 +87,15 @@ int main()
|
||||
Clock::time_point t1 = Clock::now();
|
||||
BOOST_TEST(t1 - t0 < ms(100));
|
||||
}
|
||||
// {
|
||||
// boost::future<int> f = boost::async(boost::launch::deferred, f0);
|
||||
// boost::this_thread::sleep_for(ms(300));
|
||||
// Clock::time_point t0 = Clock::now();
|
||||
// BOOST_TEST(f.get() == 3);
|
||||
// Clock::time_point t1 = Clock::now();
|
||||
// BOOST_TEST(t1 - t0 > ms(100));
|
||||
// }
|
||||
//
|
||||
{
|
||||
boost::future<int> f = boost::async(boost::launch::deferred, f0);
|
||||
boost::this_thread::sleep_for(ms(300));
|
||||
Clock::time_point t0 = Clock::now();
|
||||
BOOST_TEST(f.get() == 3);
|
||||
Clock::time_point t1 = Clock::now();
|
||||
BOOST_TEST(t1 - t0 > ms(100));
|
||||
}
|
||||
|
||||
{
|
||||
boost::future<int&> f = boost::async(f1);
|
||||
boost::this_thread::sleep_for(ms(300));
|
||||
@@ -177,15 +120,15 @@ int main()
|
||||
Clock::time_point t1 = Clock::now();
|
||||
BOOST_TEST(t1 - t0 < ms(100));
|
||||
}
|
||||
// {
|
||||
// boost::future<int&> f = boost::async(boost::launch::deferred, f1);
|
||||
// boost::this_thread::sleep_for(ms(300));
|
||||
// Clock::time_point t0 = Clock::now();
|
||||
// BOOST_TEST(&f.get() == &i);
|
||||
// Clock::time_point t1 = Clock::now();
|
||||
// BOOST_TEST(t1 - t0 > ms(100));
|
||||
// }
|
||||
//
|
||||
{
|
||||
boost::future<int&> f = boost::async(boost::launch::deferred, f1);
|
||||
boost::this_thread::sleep_for(ms(300));
|
||||
Clock::time_point t0 = Clock::now();
|
||||
BOOST_TEST(&f.get() == &i);
|
||||
Clock::time_point t1 = Clock::now();
|
||||
BOOST_TEST(t1 - t0 > ms(100));
|
||||
}
|
||||
|
||||
{
|
||||
boost::future<void> f = boost::async(f2);
|
||||
boost::this_thread::sleep_for(ms(300));
|
||||
@@ -210,32 +153,32 @@ int main()
|
||||
Clock::time_point t1 = Clock::now();
|
||||
BOOST_TEST(t1 - t0 < ms(100));
|
||||
}
|
||||
// {
|
||||
// boost::future<void> f = boost::async(boost::launch::deferred, f2);
|
||||
// boost::this_thread::sleep_for(ms(300));
|
||||
// Clock::time_point t0 = Clock::now();
|
||||
// f.get();
|
||||
// Clock::time_point t1 = Clock::now();
|
||||
// BOOST_TEST(t1 - t0 > ms(100));
|
||||
// }
|
||||
{
|
||||
boost::future<void> f = boost::async(boost::launch::deferred, f2);
|
||||
boost::this_thread::sleep_for(ms(300));
|
||||
Clock::time_point t0 = Clock::now();
|
||||
f.get();
|
||||
Clock::time_point t1 = Clock::now();
|
||||
BOOST_TEST(t1 - t0 > ms(100));
|
||||
}
|
||||
|
||||
// {
|
||||
// boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(f3, 3);
|
||||
// boost::this_thread::sleep_for(ms(300));
|
||||
// Clock::time_point t0 = Clock::now();
|
||||
// BOOST_TEST(*f.get() == 3);
|
||||
// Clock::time_point t1 = Clock::now();
|
||||
// BOOST_TEST(t1 - t0 < ms(100));
|
||||
// }
|
||||
{
|
||||
boost::future<boost::unique_ptr<int>> f = boost::async(f3, 3);
|
||||
boost::this_thread::sleep_for(ms(300));
|
||||
Clock::time_point t0 = Clock::now();
|
||||
BOOST_TEST(*f.get() == 3);
|
||||
Clock::time_point t1 = Clock::now();
|
||||
BOOST_TEST(t1 - t0 < ms(100));
|
||||
}
|
||||
|
||||
// {
|
||||
// boost::future<boost::interprocess::unique_ptr<int, boost::default_delete<int> > > f = boost::async(f4, boost::interprocess::unique_ptr<int, boost::default_delete<int> >(new int(3)));
|
||||
// boost::this_thread::sleep_for(ms(300));
|
||||
// Clock::time_point t0 = Clock::now();
|
||||
// BOOST_TEST(*f.get() == 3);
|
||||
// Clock::time_point t1 = Clock::now();
|
||||
// BOOST_TEST(t1 - t0 < ms(100));
|
||||
// }
|
||||
{
|
||||
boost::future<boost::unique_ptr<int>> f = boost::async(f4, boost::unique_ptr<int>(new int(3)));
|
||||
boost::this_thread::sleep_for(ms(300));
|
||||
Clock::time_point t0 = Clock::now();
|
||||
BOOST_TEST(*f.get() == 3);
|
||||
Clock::time_point t1 = Clock::now();
|
||||
BOOST_TEST(t1 - t0 < ms(100));
|
||||
}
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
|
||||
@@ -36,5 +36,13 @@ int main()
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -34,5 +34,13 @@ int main()
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <boost/thread/future.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
|
||||
#include "../test_allocator.hpp"
|
||||
#include <libs/thread/test/sync/futures/test_allocator.hpp>
|
||||
#endif
|
||||
|
||||
int main()
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <boost/thread/future.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
|
||||
#include "../test_allocator.hpp"
|
||||
#include <libs/thread/test/sync/futures/test_allocator.hpp>
|
||||
|
||||
double fct()
|
||||
{
|
||||
@@ -44,27 +44,20 @@ public:
|
||||
BOOST_THREAD_COPYABLE_AND_MOVABLE(A)
|
||||
static int n_moves;
|
||||
static int n_copies;
|
||||
static int n_instances;
|
||||
static int n_destroy;
|
||||
|
||||
explicit A(long i) : data_(i)
|
||||
{
|
||||
++n_instances;
|
||||
}
|
||||
A(BOOST_THREAD_RV_REF(A) a) : data_(BOOST_THREAD_RV(a).data_)
|
||||
{
|
||||
++n_instances;
|
||||
++n_moves; BOOST_THREAD_RV(a).data_ = -1;
|
||||
}
|
||||
A(const A& a) : data_(a.data_)
|
||||
{
|
||||
++n_instances;
|
||||
++n_copies;
|
||||
}
|
||||
~A()
|
||||
{
|
||||
--n_instances;
|
||||
++n_destroy;
|
||||
}
|
||||
|
||||
long operator()() const
|
||||
@@ -75,8 +68,6 @@ public:
|
||||
|
||||
int A::n_moves = 0;
|
||||
int A::n_copies = 0;
|
||||
int A::n_instances = 0;
|
||||
int A::n_destroy = 0;
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -92,8 +83,6 @@ int main()
|
||||
}
|
||||
BOOST_TEST(A::n_copies == 0);
|
||||
BOOST_TEST(A::n_moves > 0);
|
||||
BOOST_TEST(A::n_instances == 0);
|
||||
BOOST_TEST(A::n_destroy > 0);
|
||||
BOOST_TEST(test_alloc_base::count == 0);
|
||||
A::n_copies = 0;
|
||||
A::n_copies = 0;
|
||||
|
||||
@@ -45,5 +45,13 @@ int main()
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -45,5 +45,13 @@ int main()
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
|
||||
#include "../test_allocator.hpp"
|
||||
#include <libs/thread/test/sync/futures/test_allocator.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <boost/thread/future.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
|
||||
#include "../test_allocator.hpp"
|
||||
#include <libs/thread/test/sync/futures/test_allocator.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
@@ -31,5 +31,13 @@ int main()
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -30,5 +30,13 @@ int main()
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <boost/thread/future.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
|
||||
#include "../test_allocator.hpp"
|
||||
#include <libs/thread/test/sync/futures/test_allocator.hpp>
|
||||
#endif
|
||||
|
||||
boost::mutex m0;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <boost/thread/future.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
#if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
|
||||
#include "../test_allocator.hpp"
|
||||
#include <libs/thread/test/sync/futures/test_allocator.hpp>
|
||||
#endif
|
||||
|
||||
boost::mutex m;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
|
||||
#include "../test_allocator.hpp"
|
||||
#include <libs/thread/test/sync/futures/test_allocator.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
@@ -33,5 +33,13 @@ int main()
|
||||
|
||||
}
|
||||
|
||||
#include "../../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -32,5 +32,13 @@ int main()
|
||||
boost::lock_guard<boost::mutex> lk1 = lk0;
|
||||
}
|
||||
|
||||
#include "../../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -29,5 +29,13 @@ int main()
|
||||
|
||||
}
|
||||
|
||||
#include "../../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -28,5 +28,13 @@ int main()
|
||||
}
|
||||
}
|
||||
|
||||
#include "../../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -37,5 +37,13 @@ int main()
|
||||
|
||||
}
|
||||
|
||||
#include "../../../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -36,5 +36,13 @@ int main()
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
|
||||
#include "../../../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -33,5 +33,13 @@ int main()
|
||||
|
||||
}
|
||||
|
||||
#include "../../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -32,5 +32,13 @@ int main()
|
||||
boost::shared_lock_guard<boost::shared_mutex> lk1 = lk0;
|
||||
}
|
||||
|
||||
#include "../../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -37,5 +37,13 @@ int main()
|
||||
|
||||
}
|
||||
|
||||
#include "../../../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -36,5 +36,13 @@ int main()
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
|
||||
#include "../../../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -35,5 +35,13 @@ int main()
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#include "../../../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -37,5 +37,13 @@ int main()
|
||||
|
||||
}
|
||||
|
||||
#include "../../../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -36,5 +36,13 @@ int main()
|
||||
BOOST_TEST(lk0.owns_lock() == false);
|
||||
}
|
||||
|
||||
#include "../../../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -27,5 +27,13 @@ int main()
|
||||
boost::mutex m1(m0);
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -27,5 +27,13 @@ int main()
|
||||
boost::mutex m1(m0);
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -27,5 +27,13 @@ int main()
|
||||
boost::recursive_mutex m1(m0);
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -27,5 +27,13 @@ int main()
|
||||
boost::recursive_mutex m1(m0);
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -27,4 +27,13 @@ int main()
|
||||
boost::recursive_timed_mutex m1(m0);
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -27,5 +27,13 @@ int main()
|
||||
boost::recursive_timed_mutex m1(m0);
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -27,5 +27,13 @@ int main()
|
||||
boost::shared_mutex m1(m0);
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,15 @@ int main()
|
||||
boost::shared_mutex m1(m0);
|
||||
}
|
||||
|
||||
#include "../../../remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -27,5 +27,14 @@ int main()
|
||||
boost::timed_mutex m1(m0);
|
||||
}
|
||||
|
||||
#include "impl/thread/test/remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
|
||||
}
|
||||
|
||||
@@ -27,4 +27,13 @@ int main()
|
||||
boost::timed_mutex m1(m0);
|
||||
}
|
||||
|
||||
#include "impl/thread/test/remove_error_code_unused_warning.hpp"
|
||||
void remove_unused_warning()
|
||||
{
|
||||
//../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
|
||||
//../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
|
||||
|
||||
(void)boost::system::posix_category;
|
||||
(void)boost::system::errno_ecat;
|
||||
(void)boost::system::native_ecat;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user