|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r80668 - in branches/release: boost/thread boost/thread/detail boost/thread/pthread libs/thread libs/thread/doc libs/thread/src/pthread libs/thread/src/win32 libs/thread/test libs/thread/test/threads/thread/constr
From: vicente.botet_at_[hidden]
Date: 2012-09-23 08:38:02
Author: viboes
Date: 2012-09-23 08:38:00 EDT (Sun, 23 Sep 2012)
New Revision: 80668
URL: http://svn.boost.org/trac/boost/changeset/80668
Log:
Thread: Merge from trunk
Properties modified:
branches/release/boost/thread/ (props changed)
branches/release/libs/thread/ (props changed)
Text files modified:
branches/release/boost/thread/detail/config.hpp | 11 +
branches/release/boost/thread/future.hpp | 4
branches/release/boost/thread/pthread/once.hpp | 23 +-
branches/release/libs/thread/doc/future_ref.qbk | 282 ++++++++++++++++++++++++++++++++++++---
branches/release/libs/thread/doc/futures.qbk | 13
branches/release/libs/thread/doc/mutex_concepts.qbk | 21 +-
branches/release/libs/thread/doc/overview.qbk | 8
branches/release/libs/thread/doc/thread.qbk | 5
branches/release/libs/thread/doc/thread_ref.qbk | 8
branches/release/libs/thread/doc/time.qbk | 18 +-
branches/release/libs/thread/src/pthread/thread.cpp | 17 -
branches/release/libs/thread/src/win32/thread.cpp | 2
branches/release/libs/thread/test/test_4882.cpp | 14 +
branches/release/libs/thread/test/threads/thread/constr/move_pass.cpp | 10
14 files changed, 341 insertions(+), 95 deletions(-)
Modified: branches/release/boost/thread/detail/config.hpp
==============================================================================
--- branches/release/boost/thread/detail/config.hpp (original)
+++ branches/release/boost/thread/detail/config.hpp 2012-09-23 08:38:00 EDT (Sun, 23 Sep 2012)
@@ -8,9 +8,20 @@
#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
#define BOOST_THREAD_DONT_USE_CHRONO
Modified: branches/release/boost/thread/future.hpp
==============================================================================
--- branches/release/boost/thread/future.hpp (original)
+++ branches/release/boost/thread/future.hpp 2012-09-23 08:38:00 EDT (Sun, 23 Sep 2012)
@@ -136,6 +136,10 @@
{
return ec_;
}
+ const char* what() const BOOST_THREAD_NOEXCEPT_OR_THROW
+ {
+ return code().message().c_str();
+ }
};
Modified: branches/release/boost/thread/pthread/once.hpp
==============================================================================
--- branches/release/boost/thread/pthread/once.hpp (original)
+++ branches/release/boost/thread/pthread/once.hpp 2012-09-23 08:38:00 EDT (Sun, 23 Sep 2012)
@@ -12,17 +12,17 @@
#include <boost/thread/detail/config.hpp>
-#include <pthread.h>
-#include <boost/assert.hpp>
#include <boost/thread/pthread/pthread_mutex_scoped_lock.hpp>
-#include <boost/cstdint.hpp>
#include <boost/thread/detail/delete.hpp>
-// Force SIG_ATOMIC_MAX tobe defined
-#define __STDC_LIMIT_MACROS
-#include <csignal>
+#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>
+
namespace boost
{
@@ -92,21 +92,18 @@
if(flag.epoch==uninitialized_flag)
{
flag.epoch=being_initialized;
-#ifndef BOOST_NO_EXCEPTIONS
- try // BOOST_NO_EXCEPTIONS protected
+ BOOST_TRY
{
-#endif
pthread::pthread_mutex_scoped_unlock relocker(&detail::once_epoch_mutex);
f();
-#ifndef BOOST_NO_EXCEPTIONS
}
- catch(...) // BOOST_NO_EXCEPTIONS protected
+ BOOST_CATCH (...)
{
flag.epoch=uninitialized_flag;
BOOST_VERIFY(!pthread_cond_broadcast(&detail::once_epoch_cv));
- throw; // BOOST_NO_EXCEPTIONS protected
+ BOOST_RETHROW
}
-#endif
+ BOOST_CATCH_END
flag.epoch=--detail::once_global_epoch;
BOOST_VERIFY(!pthread_cond_broadcast(&detail::once_epoch_cv));
}
Modified: branches/release/libs/thread/doc/future_ref.qbk
==============================================================================
--- branches/release/libs/thread/doc/future_ref.qbk (original)
+++ branches/release/libs/thread/doc/future_ref.qbk 2012-09-23 08:38:00 EDT (Sun, 23 Sep 2012)
@@ -27,6 +27,17 @@
no_state
};
+ enum class launch
+ {
+ async = unspecified,
+ deferred = unspecified,
+ any = async | deferred
+ };
+
+ enum class future_status {
+ ready, timeout, deferred
+ };
+
namespace system
{
template <>
@@ -115,6 +126,18 @@
}
[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>`]
namespace system
@@ -132,6 +155,12 @@
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()`]
@@ -140,11 +169,26 @@
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`]
@@ -157,6 +201,34 @@
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`]
@@ -408,16 +480,96 @@
[endsect]
+[section:wait_for Member function `wait_for()`]
-[section:is_ready Member function `is_ready()` EXTENSION]
+ template <class Rep, class Period>
+ future_status wait_for(const chrono::duration<Rep, Period>& rel_time) const;
- bool is_ready();
+[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:] [Checks to see if the asynchronous result associated with `*this` is set.]]
+[[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:] [
-[[Returns:] [`true` if `*this` is associated with an asynchronous result, and that result is ready for retrieval, `false`
+- `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;
+
+[variablelist
+
+[[Returns:] [`true` if `*this` is associated with an asynchronous result and that result is ready for retrieval, `false`
otherwise.]]
[[Throws:] [Nothing.]]
@@ -428,12 +580,10 @@
[section:has_value Member function `has_value()` EXTENSION]
- bool has_value();
+ bool has_value() const;
[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.]]
@@ -445,12 +595,10 @@
[section:has_exception Member function `has_exception()` EXTENSION]
- bool has_exception();
+ bool has_exception() const;
[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.]]
@@ -642,13 +790,95 @@
[endsect]
-[section:is_ready Member function `is_ready()` EXTENSION]
+[section:wait_for Member function `wait_for()`]
+
+ template <class Rep, class Period>
+ future_status wait_for(const chrono::duration<Rep, Period>& rel_time) const;
- bool is_ready();
[variablelist
-[[Effects:] [Checks to see if the asynchronous result associated with `*this` is set.]]
+[[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;
+
+[variablelist
[[Returns:] [`true` if `*this` is associated with an asynchronous result, and that result is ready for retrieval, `false`
otherwise.]]
@@ -661,12 +891,10 @@
[section:has_value Member function `has_value()` EXTENSION]
- bool has_value();
+ bool has_value() const;
[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.]]
@@ -678,12 +906,10 @@
[section:has_exception Member function `has_exception()` EXTENSION]
- bool has_exception();
+ bool has_exception() const;
[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.]]
@@ -1136,7 +1362,7 @@
template <class T>
typename decay<T>::type decay_copy(T&& v)
{
- return std::forward<T>(v);
+ return boost::forward<T>(v);
}
[endsect]
@@ -1161,7 +1387,7 @@
[[Requires:] [
``
-decay_copy(std::forward<F>(f))()
+decay_copy(boost::forward<F>(f))()
``
shall be a valid expression.
@@ -1172,9 +1398,9 @@
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(std::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(std::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::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(std::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(std::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.)
+- 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.)
]]
@@ -1202,7 +1428,7 @@
]]
-[[Remarks:] [The first signature shall not participate in overload resolution if decay<F>::type is std::launch.
+[[Remarks:] [The first signature shall not participate in overload resolution if decay<F>::type is boost::launch.
]]
]
@@ -1211,12 +1437,12 @@
[variablelist
-[[Requires:] [F and each Ti in Args shall satisfy the MoveConstructible requirements. INVOKE (DECAY_- COPY (std::forward<F>(f)), decay_copy (std::forward<Args>(args))...) shall be a valid expression.
+[[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 (std::forward<F>(f)), decay_copy (std::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(std::forward<F>(f)), DECAY_- COPY (std::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 (std::forward<F>(f)) and decay_copy (std::forward<Args>(args))... in the shared state. These copies of f and args constitute a deferred function. Invocation of the deferred function evaluates INVOKE (std::move(g), std::move(xyz)) where g is the stored value of decay_copy (std::forward<F>(f)) and xyz is the stored copy of decay_copy (std::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 (std::move(g), std::move(xyz)) begins, the function is no longer considered deferred.
+- 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.
]]
@@ -1241,7 +1467,7 @@
- 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 std:: launch.
+[[Remarks:] [The first signature shall not participate in overload resolution if decay<F>::type is boost::launch.
]]
]
Modified: branches/release/libs/thread/doc/futures.qbk
==============================================================================
--- branches/release/libs/thread/doc/futures.qbk (original)
+++ branches/release/libs/thread/doc/futures.qbk 2012-09-23 08:38:00 EDT (Sun, 23 Sep 2012)
@@ -27,22 +27,22 @@
[def __unique_future `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::unique_future<R>::get()`]]
+[def __unique_future_get__ [unique_future_get_link `boost::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::unique_future<R>::wait()`]]
+[def __unique_future_wait__ [unique_future_wait_link `boost::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::unique_future<R>::is_ready()`]]
+[def __unique_future_is_ready__ [unique_future_is_ready_link `boost::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::unique_future<R>::has_value()`]]
+[def __unique_future_has_value__ [unique_future_has_value_link `boost::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::unique_future<R>::has_exception()`]]
+[def __unique_future_has_exception__ [unique_future_has_exception_link `boost::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::unique_future<R>::get_state()`]]
+[def __unique_future_get_state__ [unique_future_get_state_link `boost::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,6 +70,7 @@
[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()`]]
Modified: branches/release/libs/thread/doc/mutex_concepts.qbk
==============================================================================
--- branches/release/libs/thread/doc/mutex_concepts.qbk (original)
+++ branches/release/libs/thread/doc/mutex_concepts.qbk 2012-09-23 08:38:00 EDT (Sun, 23 Sep 2012)
@@ -75,7 +75,7 @@
[endsect]
[section:lockable `Lockable` Concept]
-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`):
+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`):
* `m.__try_lock()`
@@ -343,7 +343,8 @@
__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 __SharedLockable requirements if it meets the __TimedLockable requirements and the following expressions are well-formed and have the specified semantics.
+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.
[*Variables:]
@@ -360,7 +361,7 @@
* `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)`
@@ -1069,7 +1070,7 @@
[[Requires:] [The supplied `Mutex` type must implement `__try_unlock_shared_and_lock()`.]]
-[[Effects:] [Constructs an object of type __unique_lock. Let `pm` be and `owns` the ownership state. Initializes `pm` with nullptr and `owns` with false.
+[[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.
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`.]]
@@ -1095,8 +1096,8 @@
[[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()` 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`.]]
+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`.]]
[[Note:] [If `sl.owns_lock()` returns `true` and `sl.mutex()-> __try_unlock_shared_and_lock_until(abs_time)` returns `false`, `sl` is not modified.]]
@@ -1119,7 +1120,7 @@
[[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.]]
@@ -1720,7 +1721,7 @@
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_ca(SharedLockable &m, boost::adopt_lock_t)` constructor allows the __shared_lock_guard object to
+In addition, the `__shared_lock_guard_constructor_adopt(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)`]
@@ -1791,9 +1792,9 @@
[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()`.]]
Modified: branches/release/libs/thread/doc/overview.qbk
==============================================================================
--- branches/release/libs/thread/doc/overview.qbk (original)
+++ branches/release/libs/thread/doc/overview.qbk 2012-09-23 08:38:00 EDT (Sun, 23 Sep 2012)
@@ -12,7 +12,9 @@
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 0). Anthony Williams version (version 1) was a major rewrite designed to
+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
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],
@@ -20,8 +22,8 @@
[@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 in 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 features have been added also as thread attributes, reverse_lock, shared_lock_guard.
+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.
In order to use the classes and functions described here, you can
either include the specific headers specified by the descriptions of
Modified: branches/release/libs/thread/doc/thread.qbk
==============================================================================
--- branches/release/libs/thread/doc/thread.qbk (original)
+++ branches/release/libs/thread/doc/thread.qbk 2012-09-23 08:38:00 EDT (Sun, 23 Sep 2012)
@@ -135,6 +135,7 @@
[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()`]]
@@ -158,15 +159,17 @@
[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 `boost::thread`]]
+[def __thread [link thread.thread_management.thread `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()`]]
Modified: branches/release/libs/thread/doc/thread_ref.qbk
==============================================================================
--- branches/release/libs/thread/doc/thread_ref.qbk (original)
+++ branches/release/libs/thread/doc/thread_ref.qbk 2012-09-23 08:38:00 EDT (Sun, 23 Sep 2012)
@@ -686,7 +686,7 @@
[[Error Conditions:] [
-[*resource_deadlock_would_occur]: if deadlock is detected or this->get_id() == std::this_thread::get_id().
+[*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.
@@ -729,7 +729,7 @@
[[Error Conditions:] [
-[*resource_deadlock_would_occur]: if deadlock is detected or this->get_id() == std::this_thread::get_id().
+[*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.
@@ -769,7 +769,7 @@
[[Error Conditions:] [
-[*resource_deadlock_would_occur]: if deadlock is detected or this->get_id() == std::this_thread::get_id().
+[*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.
@@ -809,7 +809,7 @@
[[Error Conditions:] [
-[*resource_deadlock_would_occur]: if deadlock is detected or this->get_id() == std::this_thread::get_id().
+[*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.
Modified: branches/release/libs/thread/doc/time.qbk
==============================================================================
--- branches/release/libs/thread/doc/time.qbk (original)
+++ branches/release/libs/thread/doc/time.qbk 2012-09-23 08:38:00 EDT (Sun, 23 Sep 2012)
@@ -10,14 +10,16 @@
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):
-* __sleep_for
-* __sleep_until
-* __try_join_for
-* __try_join_until
-* __wait_for
-* __wait_until
-* __try_lock_for
-* __try_lock_until
+* `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`
[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):
Modified: branches/release/libs/thread/src/pthread/thread.cpp
==============================================================================
--- branches/release/libs/thread/src/pthread/thread.cpp (original)
+++ branches/release/libs/thread/src/pthread/thread.cpp 2012-09-23 08:38:00 EDT (Sun, 23 Sep 2012)
@@ -148,20 +148,17 @@
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());
-#ifndef BOOST_NO_EXCEPTIONS
- try // BOOST_NO_EXCEPTIONS protected
-#endif
+ BOOST_TRY
{
thread_info->run();
}
-#ifndef BOOST_NO_EXCEPTIONS
- catch(thread_interrupted const&) // BOOST_NO_EXCEPTIONS protected
+ BOOST_CATCH (thread_interrupted const&)
{
}
-#endif
+ BOOST_CATCH_END
// 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
+// BOOST_CATCH(...)
// {
// std::terminate();
// }
@@ -649,7 +646,7 @@
return ¤t_node->second;
}
}
- return NULL;
+ return 0;
}
void* get_tss_data(void const* key)
@@ -658,7 +655,7 @@
{
return current_node->value;
}
- return NULL;
+ return 0;
}
void add_new_tss_node(void const* key,
@@ -695,7 +692,7 @@
erase_tss_node(key);
}
}
- else
+ else if(func || (tss_data!=0))
{
add_new_tss_node(key,func,tss_data);
}
Modified: branches/release/libs/thread/src/win32/thread.cpp
==============================================================================
--- branches/release/libs/thread/src/win32/thread.cpp (original)
+++ branches/release/libs/thread/src/win32/thread.cpp 2012-09-23 08:38:00 EDT (Sun, 23 Sep 2012)
@@ -692,7 +692,7 @@
erase_tss_node(key);
}
}
- else
+ else if(func || (tss_data!=0))
{
add_new_tss_node(key,func,tss_data);
}
Modified: branches/release/libs/thread/test/test_4882.cpp
==============================================================================
--- branches/release/libs/thread/test/test_4882.cpp (original)
+++ branches/release/libs/thread/test/test_4882.cpp 2012-09-23 08:38:00 EDT (Sun, 23 Sep 2012)
@@ -5,6 +5,7 @@
#include <boost/thread/thread.hpp>
#include <boost/thread/shared_mutex.hpp>
+#include <boost/detail/no_exceptions_support.hpp>
#include <iostream>
@@ -13,9 +14,7 @@
void thread()
{
std::cout << __FILE__ << ":" << __LINE__ << std::endl;
-#ifndef BOOST_NO_EXCEPTIONS
- try
-#endif
+ BOOST_TRY
{
for (int i =0; i<10; ++i)
{
@@ -30,12 +29,15 @@
}
}
}
-#ifndef BOOST_NO_EXCEPTIONS
- catch (boost::lock_error& le)
+ BOOST_CATCH (boost::lock_error& le)
{
std::cerr << "lock_error exception\n";
}
-#endif
+ BOOST_CATCH (...)
+ {
+ std::cerr << " exception\n";
+ }
+ BOOST_CATCH_END
std::cout << __FILE__ << ":" << __LINE__ << std::endl;
}
Modified: branches/release/libs/thread/test/threads/thread/constr/move_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/threads/thread/constr/move_pass.cpp (original)
+++ branches/release/libs/thread/test/threads/thread/constr/move_pass.cpp 2012-09-23 08:38:00 EDT (Sun, 23 Sep 2012)
@@ -48,7 +48,7 @@
void operator()()
{
BOOST_TEST(alive_ == 1);
- BOOST_TEST(n_alive == 1);
+ //BOOST_TEST(n_alive == 1);
op_run = true;
}
@@ -56,7 +56,7 @@
{
BOOST_TEST(alive_ == 1);
std::cout << __FILE__ << ":" << __LINE__ <<" " << n_alive << std::endl;
- BOOST_TEST(n_alive == 1);
+ //BOOST_TEST(n_alive == 1);
BOOST_TEST(i == 5);
BOOST_TEST(j == 5.5);
op_run = true;
@@ -73,7 +73,7 @@
int main()
{
{
- BOOST_TEST(G::n_alive == 0);
+ //BOOST_TEST(G::n_alive == 0);
BOOST_TEST(!G::op_run);
boost::thread t0((G()));
boost::thread::id id = t0.get_id();
@@ -83,12 +83,12 @@
t1.join();
BOOST_TEST(G::op_run);
}
- BOOST_TEST(G::n_alive == 0);
+ //BOOST_TEST(G::n_alive == 0);
{
boost::thread t1((BOOST_THREAD_MAKE_RV_REF(make_thread())));
t1.join();
BOOST_TEST(G::op_run);
}
- BOOST_TEST(G::n_alive == 0);
+ //BOOST_TEST(G::n_alive == 0);
return boost::report_errors();
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk