|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r82471 - in trunk: boost/thread boost/thread/detail libs/thread/doc libs/thread/test/sync/futures/future libs/thread/test/sync/mutual_exclusion/locks/lock_guard libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock libs/thread/test/sync/mutual_exclusion/locks/strict_lock libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons
From: vicente.botet_at_[hidden]
Date: 2013-01-12 17:22:00
Author: viboes
Date: 2013-01-12 17:21:58 EST (Sat, 12 Jan 2013)
New Revision: 82471
URL: http://svn.boost.org/trac/boost/changeset/82471
Log:
Thread: added specific macros to state if some lock factories are not provided
Text files modified:
trunk/boost/thread/detail/config.hpp | 7 +++-
trunk/boost/thread/lock_factories.hpp | 16 +---------
trunk/boost/thread/lock_guard.hpp | 2
trunk/boost/thread/strict_lock.hpp | 2
trunk/libs/thread/doc/changes.qbk | 4 ++
trunk/libs/thread/doc/mutex_concepts.qbk | 8 +++--
trunk/libs/thread/test/sync/futures/future/then_pass.cpp | 59 ++++++++++++++++++++++++---------------
trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_adopt_lock_pass.cpp | 4 +-
trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_pass.cpp | 4 +-
trunk/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/make_nested_strict_lock_pass.cpp | 4 +-
trunk/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/make_strict_lock_pass.cpp | 4 +-
trunk/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_locks_mutex_pass.cpp | 2
12 files changed, 63 insertions(+), 53 deletions(-)
Modified: trunk/boost/thread/detail/config.hpp
==============================================================================
--- trunk/boost/thread/detail/config.hpp (original)
+++ trunk/boost/thread/detail/config.hpp 2013-01-12 17:21:58 EST (Sat, 12 Jan 2013)
@@ -69,13 +69,16 @@
#if defined BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX || defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
#define BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
+#define BOOST_THREAD_NO_MAKE_LOCK_GUARD
+#define BOOST_THREAD_NO_MAKE_STRICT_LOCK
+#define BOOST_THREAD_NO_MAKE_NESTED_STRICT_LOCK
#endif
#if defined(BOOST_NO_CXX11_HDR_TUPLE) || defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
-#define BOOST_THREAD_NO_CXX11_HDR_TUPLE
+#define BOOST_THREAD_NO_MAKE_UNIQUE_LOCKS
#elif defined _MSC_VER && _MSC_VER <= 1600
// C++ features supported by VC++ 10 (aka 2010)
-#define BOOST_THREAD_NO_CXX11_HDR_TUPLE
+#define BOOST_THREAD_NO_MAKE_UNIQUE_LOCKS
#endif
/// BASIC_THREAD_ID
Modified: trunk/boost/thread/lock_factories.hpp
==============================================================================
--- trunk/boost/thread/lock_factories.hpp (original)
+++ trunk/boost/thread/lock_factories.hpp 2013-01-12 17:21:58 EST (Sat, 12 Jan 2013)
@@ -8,7 +8,7 @@
#include <boost/thread/lock_types.hpp>
#include <boost/thread/lock_algorithms.hpp>
-#if ! defined(BOOST_THREAD_NO_CXX11_HDR_TUPLE)
+#if ! defined(BOOST_THREAD_NO_MAKE_UNIQUE_LOCKS)
#include <tuple> // todo change to <boost/tuple.hpp> once Boost.Tuple or Boost.Fusion provides Move semantics.
#endif
#include <boost/config/abi_prefix.hpp>
@@ -39,7 +39,7 @@
{
return unique_lock<Lockable> (mtx, try_to_lock);
}
-#if ! defined(BOOST_THREAD_NO_CXX11_HDR_TUPLE)
+#if ! defined(BOOST_THREAD_NO_MAKE_UNIQUE_LOCKS)
#if ! defined BOOST_NO_CXX11_VARIADIC_TEMPLATES
template <typename ...Lockable>
@@ -71,18 +71,6 @@
#endif
#endif
-// int main()
-// {
-// std::mutex m1;
-// std::mutex m2;
-// std::mutex m3;
-//
-// {
-// auto lks = make_unique_locks(m1, m2, m3);
-//
-// }
-// return 0;
-// }
}
Modified: trunk/boost/thread/lock_guard.hpp
==============================================================================
--- trunk/boost/thread/lock_guard.hpp (original)
+++ trunk/boost/thread/lock_guard.hpp 2013-01-12 17:21:58 EST (Sat, 12 Jan 2013)
@@ -69,7 +69,7 @@
};
-#if ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined BOOST_THREAD_NO_MAKE_LOCK_GUARD
template <typename Lockable>
lock_guard<Lockable> make_lock_guard(Lockable& mtx)
{
Modified: trunk/boost/thread/strict_lock.hpp
==============================================================================
--- trunk/boost/thread/strict_lock.hpp (original)
+++ trunk/boost/thread/strict_lock.hpp 2013-01-12 17:21:58 EST (Sat, 12 Jan 2013)
@@ -204,7 +204,7 @@
{
};
-#if ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined BOOST_THREAD_NO_MAKE_STRICT_LOCK
template <typename Lockable>
strict_lock<Lockable> make_strict_lock(Lockable& mtx)
{
Modified: trunk/libs/thread/doc/changes.qbk
==============================================================================
--- trunk/libs/thread/doc/changes.qbk (original)
+++ trunk/libs/thread/doc/changes.qbk 2013-01-12 17:21:58 EST (Sat, 12 Jan 2013)
@@ -63,6 +63,7 @@
[*Fixed Bugs:]
+* [@http://svn.boost.org/trac/boost/ticket/7464 #7464] BOOST_TEST(n_alive == 1); fails due to race condition in a regression test tool.
* [@http://svn.boost.org/trac/boost/ticket/7657 #7657] Serious performance and memory consumption hit if condition_variable methods condition notify_one or notify_all is used repeatedly.
* [@http://svn.boost.org/trac/boost/ticket/7665 #7665] this_thread::sleep_for no longer uses steady_clock in thread.
* [@http://svn.boost.org/trac/boost/ticket/7668 #7668] thread_group::join_all() should check whether its threads are joinable.
@@ -71,6 +72,9 @@
* [@http://svn.boost.org/trac/boost/ticket/7798 #7798] boost::future set_wait_callback thread safety issues.
* [@http://svn.boost.org/trac/boost/ticket/7808 #7808] Incorrect description of effects for this_thread::sleep_for and this_thread::sleep_until.
* [@http://svn.boost.org/trac/boost/ticket/7812 #7812] Returns: cv_status::no_timeout if the call is returning because the time period specified by rel_time has elapsed, cv_status::timeout otherwise.
+* [@http://svn.boost.org/trac/boost/ticket/7874 #7874] compile warning: thread.hpp:342: warning: type attributes are honored only at type definition.
+* [@http://svn.boost.org/trac/boost/ticket/7875 #7875] BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED should not be enabled by default.
+* [@http://svn.boost.org/trac/boost/ticket/7882 #7882] wrong exception text from condition_variable::wait(unique_lock<mutex>&).
[heading Version 3.1.0 - boost 1.52]
Modified: trunk/libs/thread/doc/mutex_concepts.qbk
==============================================================================
--- trunk/libs/thread/doc/mutex_concepts.qbk (original)
+++ trunk/libs/thread/doc/mutex_concepts.qbk 2013-01-12 17:21:58 EST (Sat, 12 Jan 2013)
@@ -964,7 +964,7 @@
template<typename Lockable>
class lock_guard
- #if ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+ #if ! defined BOOST_THREAD_NO_MAKE_LOCK_GUARD
template <typename Lockable>
lock_guard<Lockable> make_lock_guard(Lockable& mtx); // EXTENSION
template <typename Lockable>
@@ -1981,9 +1981,11 @@
template <typename Lock>
struct is_strict_lock_sur_parolle<nested_strict_lock<Lock> >;
- #if ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+ #if ! defined BOOST_THREAD_NO_MAKE_STRICT_LOCK
template <typename Lockable>
strict_lock<Lockable> make_strict_lock(Lockable& mtx);
+ #endif
+ #if ! defined BOOST_THREAD_NO_MAKE_NESTED_STRICT_LOCK
template <typename Lock>
nested_strict_lock<Lock> make_nested_strict_lock(Lock& lk);
#endif
@@ -2630,7 +2632,7 @@
template <typename Lockable>
unique_lock<Lockable> make_unique_lock(Lockable& mtx, try_to_lock_t); // EXTENSION
- #if ! defined(BOOST_NO_CXX11_HDR_TUPLE)
+ #if ! defined(BOOST_THREAD_NO_MAKE_UNIQUE_LOCKS)
template <typename ...Lockable>
std::tuple<unique_lock<Lockable> ...> make_unique_locks(Lockable& ...mtx); // EXTENSION
#endif
Modified: trunk/libs/thread/test/sync/futures/future/then_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/futures/future/then_pass.cpp (original)
+++ trunk/libs/thread/test/sync/futures/future/then_pass.cpp 2013-01-12 17:21:58 EST (Sat, 12 Jan 2013)
@@ -34,37 +34,50 @@
int main()
{
BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
+ boost::future<int> f1 = boost::async(boost::launch::async, p1);
+ BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
+ boost::future<int> f2 = f1.then(p2);
+ BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
+ try
{
- boost::future<int> f1 = boost::async(p1);
- BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
- boost::future<int> f2 = f1.then(p2);
- BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
BOOST_TEST(f2.get()==2);
BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
}
+ catch (std::exception& ex)
{
- BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
- boost::future<int> f2 = boost::async(p1).then(p2);
- BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
- BOOST_TEST(f2.get()==2);
- BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
+ BOOST_THREAD_LOG << "ERRORRRRR "<<ex.what() << "" << BOOST_THREAD_END_LOG;
+ BOOST_ASSERT(false);
}
+ catch (...)
{
- BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
- boost::future<int> f1 = boost::async(p1);
- BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
- boost::future<int> f2 = f1.then(p2).then(p2);
- BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
- BOOST_TEST(f2.get()==4);
- BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
- }
- {
- BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
- boost::future<int> f2 = boost::async(p1).then(p2).then(p2);
- BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
- BOOST_TEST(f2.get()==4);
- BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
+ BOOST_THREAD_LOG << " ERRORRRRR exception thrown" << BOOST_THREAD_END_LOG;
+ BOOST_ASSERT(false);
}
+ BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
+
+// {
+// BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
+// boost::future<int> f2 = boost::async(p1).then(p2);
+// BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
+// BOOST_TEST(f2.get()==2);
+// BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
+// }
+// {
+// BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
+// boost::future<int> f1 = boost::async(p1);
+// BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
+// boost::future<int> f2 = f1.then(p2).then(p2);
+// BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
+// BOOST_TEST(f2.get()==4);
+// BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
+// }
+// {
+// BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
+// boost::future<int> f2 = boost::async(p1).then(p2).then(p2);
+// BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
+// BOOST_TEST(f2.get()==4);
+// BOOST_THREAD_LOG << BOOST_THREAD_END_LOG;
+// }
return boost::report_errors();
}
Modified: trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_adopt_lock_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_adopt_lock_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_adopt_lock_pass.cpp 2013-01-12 17:21:58 EST (Sat, 12 Jan 2013)
@@ -34,7 +34,7 @@
#endif
boost::mutex m;
-#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_MAKE_LOCK_GUARD
void f()
{
@@ -65,7 +65,7 @@
int main()
{
-#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_MAKE_LOCK_GUARD
m.lock();
boost::thread t(f);
#ifdef BOOST_THREAD_USES_CHRONO
Modified: trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_pass.cpp 2013-01-12 17:21:58 EST (Sat, 12 Jan 2013)
@@ -35,7 +35,7 @@
boost::mutex m;
-#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST && defined BOOST_THREAD_USES_CHRONO
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_MAKE_LOCK_GUARD && defined BOOST_THREAD_USES_CHRONO
void f()
{
@@ -54,7 +54,7 @@
int main()
{
-#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_MAKE_LOCK_GUARD
{
m.lock();
boost::thread t(f);
Modified: trunk/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/make_nested_strict_lock_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/make_nested_strict_lock_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/make_nested_strict_lock_pass.cpp 2013-01-12 17:21:58 EST (Sat, 12 Jan 2013)
@@ -27,7 +27,7 @@
boost::mutex m;
-#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST && defined BOOST_THREAD_USES_CHRONO
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_MAKE_NESTED_STRICT_LOCK && defined BOOST_THREAD_USES_CHRONO
void f()
{
@@ -47,7 +47,7 @@
int main()
{
-#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_MAKE_NESTED_STRICT_LOCK
{
m.lock();
boost::thread t(f);
Modified: trunk/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/make_strict_lock_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/make_strict_lock_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/make_strict_lock_pass.cpp 2013-01-12 17:21:58 EST (Sat, 12 Jan 2013)
@@ -26,7 +26,7 @@
boost::mutex m;
-#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST && defined BOOST_THREAD_USES_CHRONO
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_MAKE_STRICT_LOCK && defined BOOST_THREAD_USES_CHRONO
void f()
{
@@ -45,7 +45,7 @@
int main()
{
-#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_MAKE_STRICT_LOCK
{
m.lock();
boost::thread t(f);
Modified: trunk/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_locks_mutex_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_locks_mutex_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_locks_mutex_pass.cpp 2013-01-12 17:21:58 EST (Sat, 12 Jan 2013)
@@ -15,7 +15,7 @@
#include <boost/thread/thread.hpp>
#include <boost/detail/lightweight_test.hpp>
-#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined BOOST_THREAD_NO_CXX11_HDR_TUPLE && ! defined BOOST_NO_CXX11_RVALUE_REFERENCES
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined BOOST_THREAD_NO_MAKE_UNIQUE_LOCKS && ! defined BOOST_NO_CXX11_RVALUE_REFERENCES
boost::mutex m1;
boost::mutex m2;
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