|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r82356 - in branches/release: boost/thread boost/thread/detail libs/thread libs/thread/example libs/thread/test/sync/futures/async 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-04 13:40:51
Author: viboes
Date: 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
New Revision: 82356
URL: http://svn.boost.org/trac/boost/changeset/82356
Log:
Thread: merge from trunk latest changes.
Properties modified:
branches/release/boost/thread/ (props changed)
branches/release/libs/thread/ (props changed)
Text files modified:
branches/release/boost/thread/detail/config.hpp | 7 ++
branches/release/boost/thread/detail/lockable_wrapper.hpp | 6 +
branches/release/boost/thread/externally_locked_stream.hpp | 103 ++++++++++++++++++++++-----------------
branches/release/boost/thread/lock_factories.hpp | 2
branches/release/boost/thread/lock_guard.hpp | 5 +
branches/release/boost/thread/strict_lock.hpp | 7 +-
branches/release/libs/thread/example/not_interleaved.cpp | 33 +++++++++---
branches/release/libs/thread/test/sync/futures/async/async_pass.cpp | 3 +
branches/release/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_adopt_lock_pass.cpp | 6 +
branches/release/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_pass.cpp | 9 --
branches/release/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/make_nested_strict_lock_pass.cpp | 9 --
branches/release/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/make_strict_lock_pass.cpp | 9 --
branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_adopt_lock_pass.cpp | 19 +++----
branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_defer_lock_pass.cpp | 18 +++---
branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_mutex_pass.cpp | 33 +++++++++---
branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_try_to_lock_pass.cpp | 48 ++++++++++++-----
branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_locks_mutex_pass.cpp | 8 +-
17 files changed, 192 insertions(+), 133 deletions(-)
Modified: branches/release/boost/thread/detail/config.hpp
==============================================================================
--- branches/release/boost/thread/detail/config.hpp (original)
+++ branches/release/boost/thread/detail/config.hpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -66,6 +66,13 @@
#define BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS
#endif
+
+#if defined BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX || defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#define BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
+//#elif defined __GNUC__ && (__GNUC__ < 4 || ( __GNUC__ == 4 && __GNUC_MINOR__ <= 6 ))
+//#define BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
+#endif
+
/// BASIC_THREAD_ID
// todo to be removed for 1.54
#if ! defined BOOST_THREAD_DONT_PROVIDE_BASIC_THREAD_ID \
Modified: branches/release/boost/thread/detail/lockable_wrapper.hpp
==============================================================================
--- branches/release/boost/thread/detail/lockable_wrapper.hpp (original)
+++ branches/release/boost/thread/detail/lockable_wrapper.hpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -6,7 +6,9 @@
#ifndef BOOST_THREAD_DETAIL_LOCKABLE_WRAPPER_HPP
#define BOOST_THREAD_DETAIL_LOCKABLE_WRAPPER_HPP
-#if ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#include <boost/thread/detail/config.hpp>
+
+#if ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
#include <initializer_list>
#endif
#include <boost/config/abi_prefix.hpp>
@@ -14,7 +16,7 @@
namespace boost
{
-#if ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
namespace thread_detail
{
template <typename Mutex>
Modified: branches/release/boost/thread/externally_locked_stream.hpp
==============================================================================
--- branches/release/boost/thread/externally_locked_stream.hpp (original)
+++ branches/release/boost/thread/externally_locked_stream.hpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -4,12 +4,15 @@
// http://www.boost.org/LICENSE_1_0.txt)
-#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_HPP
-#define BOOST_THREAD_EXTERNALLY_LOCKED_HPP
+#ifndef BOOST_THREAD_EXTERNALLY_LOCKED_STREAM_HPP
+#define BOOST_THREAD_EXTERNALLY_LOCKED_STREAM_HPP
#include <boost/thread/detail/config.hpp>
+#include <boost/thread/detail/move.hpp>
+#include <boost/thread/detail/delete.hpp>
#include <boost/thread/externally_locked.hpp>
+#include <boost/thread/lock_traits.hpp>
#include <boost/thread/recursive_mutex.hpp>
#include <boost/config/abi_prefix.hpp>
@@ -17,11 +20,11 @@
namespace boost
{
- static recursive_mutex& terminal_mutex()
- {
- static recursive-mutex mtx;
- return mtx;
- }
+ // inline static recursive_mutex& terminal_mutex()
+ // {
+ // static recursive_mutex mtx;
+ // return mtx;
+ // }
template <typename Stream>
class externally_locked_stream;
@@ -29,36 +32,47 @@
template <class Stream>
class stream_guard
{
- stream_guard(externally_locked_stream<Stream>& mtx, adopt_lock_t)
- : mtx_(mtx)
+ stream_guard(externally_locked_stream<Stream>& mtx, adopt_lock_t) :
+ mtx_(mtx)
{
}
- Stream& get() const
- {
- mtx_.get(*this);
- }
- friend class externally_locked_stream<Stream>;
+ friend class externally_locked_stream<Stream> ;
public:
typedef typename externally_locked_stream<Stream>::mutex_type mutex_type;
- BOOST_THREAD_NO_COPYABLE( externally_locked_stream )
+ BOOST_THREAD_MOVABLE_ONLY( stream_guard)
- stream_guard(externally_locked_stream<Stream>& mtx)
- : mtx_(mtx)
+ stream_guard(externally_locked_stream<Stream>& mtx) :
+ mtx_(&mtx)
{
mtx.lock();
}
+ stream_guard(BOOST_THREAD_RV_REF(stream_guard) rhs)
+ : mtx_(rhs.mtx_)
+ {
+ rhs.mtx_= 0;
+ }
+
~stream_guard()
{
- mtx_.unlock();
+ if (mtx_ != 0) mtx_->unlock();
}
+ bool owns_lock(mutex_type const* l) const BOOST_NOEXCEPT
+ {
+ return l == mtx_->mutex();
+ }
+
+ Stream& get() const
+ {
+ return mtx_->get(*this);
+ }
private:
- externally_locked_stream<Stream>& mtx_;
+ externally_locked_stream<Stream>* mtx_;
};
template <typename Stream>
@@ -78,6 +92,8 @@
{
typedef externally_locked<Stream&, recursive_mutex> base_type;
public:
+ BOOST_THREAD_NO_COPYABLE( externally_locked_stream)
+
/**
* Effects: Constructs an externally locked object storing the cloaked reference object.
*/
@@ -86,60 +102,57 @@
{
}
-
stream_guard<Stream> hold()
{
- return stream_guard<Stream>(*this);
+ return stream_guard<Stream> (*this);
}
};
-//]
+ //]
template <typename Stream, typename T>
- const stream_guard<Stream>& operator<<(const stream_guard<Stream>& lck, T arg)
+ inline const stream_guard<Stream>& operator<<(const stream_guard<Stream>& lck, T arg)
{
- lck.get() << arg;
- return lck;
+ lck.get() << arg;
+ return lck;
}
template <typename Stream>
- const stream_guard<Stream>& operator<<(const stream_guard<Stream>& lck,
- Stream& (*arg)(Stream&))
+ inline const stream_guard<Stream>& operator<<(const stream_guard<Stream>& lck, Stream& (*arg)(Stream&))
{
- lck.get() << arg;
- return lck;
+ lck.get() << arg;
+ return lck;
}
template <typename Stream, typename T>
- const stream_guard<Stream>& operator>>(const stream_guard<Stream>& lck, T& arg)
+ inline const stream_guard<Stream>& operator>>(const stream_guard<Stream>& lck, T& arg)
{
- lck.get() >> arg;
- return lck;
+ lck.get() >> arg;
+ return lck;
}
template <typename Stream, typename T>
- stream_guard<Stream> operator<<(externally_locked_stream<Stream>& mtx, T arg)
+ inline stream_guard<Stream> operator<<(externally_locked_stream<Stream>& mtx, T arg)
{
- mtx.lock();
- mtx.get() << arg;
- return stream_guard<Stream>(mtx, adopt_lock);
+ stream_guard<Stream> lk(mtx);
+ mtx.get(lk) << arg;
+ return boost::move(lk);
}
template <typename Stream>
- stream_guard<Stream> operator<<(externally_locked_stream<Stream>& mtx,
- Stream& (*arg)(Stream&))
+ inline stream_guard<Stream> operator<<(externally_locked_stream<Stream>& mtx, Stream& (*arg)(Stream&))
{
- mtx.lock();
- mtx.get() << arg;
- return stream_guard<Stream>(mtx, adopt_lock);
+ stream_guard<Stream> lk(mtx);
+ mtx.get(lk) << arg;
+ return boost::move(lk);
}
template <typename Stream, typename T>
- stream_guard<Stream> operator>>(externally_locked_stream<Stream>& mtx, T& arg)
+ inline stream_guard<Stream> operator>>(externally_locked_stream<Stream>& mtx, T& arg)
{
- mtx.lock();
- mtx.get() >> arg;
- return stream_guard<Stream>(mtx, adopt_lock);
+ stream_guard<Stream> lk(mtx);
+ mtx.get(lk) >> arg;
+ return boost::move(lk);
}
}
Modified: branches/release/boost/thread/lock_factories.hpp
==============================================================================
--- branches/release/boost/thread/lock_factories.hpp (original)
+++ branches/release/boost/thread/lock_factories.hpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -59,7 +59,7 @@
);
}
template <typename L1, typename L2, typename L3>
- std::tuple<unique_lock<L1>, unique_lock<L2>, unique_lock<L3> > make_unique_locks(L1& m1, L2& m2, L2& m3)
+ std::tuple<unique_lock<L1>, unique_lock<L2>, unique_lock<L3> > make_unique_locks(L1& m1, L2& m2, L3& m3)
{
boost::lock(m1, m2, m3);
return std::tuple<unique_lock<L1>,unique_lock<L2>,unique_lock<L3> >(
Modified: branches/release/boost/thread/lock_guard.hpp
==============================================================================
--- branches/release/boost/thread/lock_guard.hpp (original)
+++ branches/release/boost/thread/lock_guard.hpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -7,6 +7,7 @@
#ifndef BOOST_THREAD_LOCK_GUARD_HPP
#define BOOST_THREAD_LOCK_GUARD_HPP
+#include <boost/thread/detail/config.hpp>
#include <boost/thread/detail/delete.hpp>
#include <boost/thread/detail/move.hpp>
#include <boost/thread/detail/lockable_wrapper.hpp>
@@ -45,7 +46,7 @@
#endif
}
-#if ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
lock_guard(std::initializer_list<thread_detail::lockable_wrapper<Mutex> > l_) :
m(*(const_cast<thread_detail::lockable_wrapper<Mutex>*>(l_.begin())->m))
{
@@ -68,7 +69,7 @@
};
-#if ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
template <typename Lockable>
lock_guard<Lockable> make_lock_guard(Lockable& mtx)
{
Modified: branches/release/boost/thread/strict_lock.hpp
==============================================================================
--- branches/release/boost/thread/strict_lock.hpp (original)
+++ branches/release/boost/thread/strict_lock.hpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -6,6 +6,7 @@
#ifndef BOOST_THREAD_STRICT_LOCK_HPP
#define BOOST_THREAD_STRICT_LOCK_HPP
+#include <boost/thread/detail/config.hpp>
#include <boost/thread/detail/delete.hpp>
#include <boost/thread/detail/lockable_wrapper.hpp>
#include <boost/thread/lock_options.hpp>
@@ -50,7 +51,7 @@
} /*< locks on construction >*/
-#if ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
strict_lock(std::initializer_list<thread_detail::lockable_wrapper<Lockable> > l_) :
mtx_(*(const_cast<thread_detail::lockable_wrapper<Lockable>*>(l_.begin())->m))
{
@@ -148,7 +149,7 @@
tmp_lk_ = move(lk); /*< Move ownership to temporary lk >*/
}
-#if ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
nested_strict_lock(std::initializer_list<thread_detail::lockable_wrapper<Lock> > l_) :
lk_(*(const_cast<thread_detail::lockable_wrapper<Lock>*>(l_.begin())->m))
{
@@ -203,7 +204,7 @@
{
};
-#if ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
template <typename Lockable>
strict_lock<Lockable> make_strict_lock(Lockable& mtx)
{
Modified: branches/release/libs/thread/example/not_interleaved.cpp
==============================================================================
--- branches/release/libs/thread/example/not_interleaved.cpp (original)
+++ branches/release/libs/thread/example/not_interleaved.cpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -6,9 +6,10 @@
// adapted from the example given by Howard Hinnant in
+#define BOOST_THREAD_VERSION 4
#include <iostream>
-#include <boost/thread/thread.hpp>
+#include <boost/thread/scoped_thread.hpp>
#include <boost/thread/externally_locked_stream.hpp>
void use_cerr(boost::externally_locked_stream<std::ostream> &mcerr)
@@ -18,7 +19,18 @@
while (chrono::steady_clock::now() < tf)
{
mcerr << "logging data to cerr\n";
- this_thread::sleep_for(milliseconds(500));
+ this_thread::sleep_for(chrono::milliseconds(500));
+ }
+}
+
+void use_cout(boost::externally_locked_stream<std::ostream> &mcout)
+{
+ using namespace boost;
+ auto tf = chrono::steady_clock::now() + chrono::seconds(5);
+ while (chrono::steady_clock::now() < tf)
+ {
+ mcout << "logging data to cout\n";
+ this_thread::sleep_for(chrono::milliseconds(250));
}
}
@@ -26,17 +38,20 @@
{
using namespace boost;
- externally_locked_stream<std::ostream> mcerr(std::cerr, terminal_mutex());
- externally_locked_stream<std::ostream> mcout(std::cerr, terminal_mutex());
- externally_locked_stream<std::istream> mcin(std::cerr, terminal_mutex());
+ recursive_mutex terminal_mutex;
- thread t1(use_cerr, mcerr);
- this_thread::sleep_for(boost::chrono::seconds(2));
+ externally_locked_stream<std::ostream> mcerr(std::cerr, terminal_mutex);
+ externally_locked_stream<std::ostream> mcout(std::cout, terminal_mutex);
+ externally_locked_stream<std::istream> mcin(std::cin, terminal_mutex);
+
+ scoped_thread<> t1(thread(use_cerr, boost::ref(mcerr)));
+ scoped_thread<> t2(thread(use_cout, boost::ref(mcout)));
+ this_thread::sleep_for(chrono::seconds(2));
std::string nm;
mcout << "Enter name: ";
- mcin >> nm;
+ //mcin >> nm;
t1.join();
mcout << nm << '\n';
- return 0;
+ return 1;
}
Modified: branches/release/libs/thread/test/sync/futures/async/async_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/futures/async/async_pass.cpp (original)
+++ branches/release/libs/thread/test/sync/futures/async/async_pass.cpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -166,6 +166,7 @@
BOOST_TEST(f.get() == 3);
Clock::time_point t1 = Clock::now();
BOOST_TEST(t1 - t0 < ms(100));
+ std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
} catch (std::exception& ex) {
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
@@ -216,6 +217,7 @@
BOOST_TEST(&f.get() == &i);
Clock::time_point t1 = Clock::now();
BOOST_TEST(t1 - t0 < ms(100));
+ std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
} catch (std::exception& ex) {
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
@@ -303,6 +305,7 @@
f.get();
Clock::time_point t1 = Clock::now();
BOOST_TEST(t1 - t0 < ms(100));
+ std::cout << __FILE__ <<"["<<__LINE__<<"] "<< (t1 - t0).count() << std::endl;
} catch (std::exception& ex) {
std::cout << __FILE__ <<"["<<__LINE__<<"]"<<ex.what() << std::endl;
BOOST_TEST(false && "exception thrown");
Modified: branches/release/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_adopt_lock_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_adopt_lock_pass.cpp (original)
+++ branches/release/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_adopt_lock_pass.cpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -17,6 +17,8 @@
// template <class Lockable>
// lock_guard<Lockable> make_lock_guard(Lockable &, adopt_lock_t);
+#define BOOST_THREAD_VERSION 4
+
#include <boost/thread/lock_guard.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
@@ -32,7 +34,7 @@
#endif
boost::mutex m;
-#if ! defined(BOOST_NO_CXX11_AUTO) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
void f()
{
@@ -63,7 +65,7 @@
int main()
{
-#if ! defined(BOOST_NO_CXX11_AUTO) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
m.lock();
boost::thread t(f);
#ifdef BOOST_THREAD_USES_CHRONO
Modified: branches/release/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_pass.cpp (original)
+++ branches/release/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/make_lock_guard_pass.cpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -18,10 +18,7 @@
// lock_guard<Lockable> make_lock_guard(Lockable &);
#define BOOST_THREAD_VERSION 4
-#define BOOST_THREAD_USES_LOG
-#define BOOST_THREAD_DONT_PROVIDE_NESTED_LOCKS
-#include <boost/thread/detail/log.hpp>
#include <boost/thread/lock_guard.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
@@ -38,7 +35,7 @@
boost::mutex m;
-#if ! defined(BOOST_NO_CXX11_AUTO) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_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_CXX11_HDR_INITIALIZER_LIST && defined BOOST_THREAD_USES_CHRONO
void f()
{
@@ -47,9 +44,7 @@
{
const auto&& lg = boost::make_lock_guard(m); (void)lg;
t1 = Clock::now();
- BOOST_THREAD_TRACE;
}
- BOOST_THREAD_TRACE;
ns d = t1 - t0 - ms(250);
// This test is spurious as it depends on the time the thread system switches the threads
BOOST_TEST(d < ns(2500000)+ms(1000)); // within 2.5ms
@@ -59,7 +54,7 @@
int main()
{
-#if ! defined(BOOST_NO_CXX11_AUTO) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
{
m.lock();
boost::thread t(f);
Modified: branches/release/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/make_nested_strict_lock_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/make_nested_strict_lock_pass.cpp (original)
+++ branches/release/libs/thread/test/sync/mutual_exclusion/locks/nested_strict_lock/make_nested_strict_lock_pass.cpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -9,10 +9,7 @@
// strict_lock<Lockable> make_strict_lock(Lockable &);
#define BOOST_THREAD_VERSION 4
-#define BOOST_THREAD_USES_LOG
-#define BOOST_THREAD_DONT_PROVIDE_NESTED_LOCKS
-#include <boost/thread/detail/log.hpp>
#include <boost/thread/lock_types.hpp>
#include <boost/thread/strict_lock.hpp>
#include <boost/thread/mutex.hpp>
@@ -30,7 +27,7 @@
boost::mutex m;
-#if ! defined(BOOST_NO_CXX11_AUTO) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_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_CXX11_HDR_INITIALIZER_LIST && defined BOOST_THREAD_USES_CHRONO
void f()
{
@@ -40,9 +37,7 @@
{
const auto&& nlg = boost::make_nested_strict_lock(lg); (void)nlg;
t1 = Clock::now();
- BOOST_THREAD_TRACE;
}
- BOOST_THREAD_TRACE;
ns d = t1 - t0 - ms(250);
// This test is spurious as it depends on the time the thread system switches the threads
BOOST_TEST(d < ns(2500000)+ms(1000)); // within 2.5ms
@@ -52,7 +47,7 @@
int main()
{
-#if ! defined(BOOST_NO_CXX11_AUTO) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
{
m.lock();
boost::thread t(f);
Modified: branches/release/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/make_strict_lock_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/make_strict_lock_pass.cpp (original)
+++ branches/release/libs/thread/test/sync/mutual_exclusion/locks/strict_lock/make_strict_lock_pass.cpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -9,10 +9,7 @@
// strict_lock<Lockable> make_strict_lock(Lockable &);
#define BOOST_THREAD_VERSION 4
-#define BOOST_THREAD_USES_LOG
-#define BOOST_THREAD_DONT_PROVIDE_NESTED_LOCKS
-#include <boost/thread/detail/log.hpp>
#include <boost/thread/strict_lock.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
@@ -29,7 +26,7 @@
boost::mutex m;
-#if ! defined(BOOST_NO_CXX11_AUTO) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_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_CXX11_HDR_INITIALIZER_LIST && defined BOOST_THREAD_USES_CHRONO
void f()
{
@@ -38,9 +35,7 @@
{
const auto&& lg = boost::make_strict_lock(m); (void)lg;
t1 = Clock::now();
- BOOST_THREAD_TRACE;
}
- BOOST_THREAD_TRACE;
ns d = t1 - t0 - ms(250);
// This test is spurious as it depends on the time the thread system switches the threads
BOOST_TEST(d < ns(2500000)+ms(1000)); // within 2.5ms
@@ -50,7 +45,7 @@
int main()
{
-#if ! defined(BOOST_NO_CXX11_AUTO) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && ! defined BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
{
m.lock();
boost::thread t(f);
Modified: branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_adopt_lock_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_adopt_lock_pass.cpp (original)
+++ branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_adopt_lock_pass.cpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -8,27 +8,24 @@
// template <class Mutex> class unique_lock;
// unique_lock<Mutex> make_unique_lock(Mutex&, adopt_lock_t);
+#define BOOST_THREAD_VERSION 4
+
#include <boost/thread/lock_factories.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/detail/lightweight_test.hpp>
-#if ! defined(BOOST_NO_CXX11_AUTO) && ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
-
int main()
{
boost::mutex m;
m.lock();
- auto lk = boost::make_unique_lock(m, boost::adopt_lock);
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)
+ auto
+#else
+ boost::unique_lock<boost::mutex>
+#endif
+ lk = boost::make_unique_lock(m, boost::adopt_lock);
BOOST_TEST(lk.mutex() == &m);
BOOST_TEST(lk.owns_lock() == true);
return boost::report_errors();
}
-
-#else
-int main()
-{
- return boost::report_errors();
-}
-#endif
-
Modified: branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_defer_lock_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_defer_lock_pass.cpp (original)
+++ branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_defer_lock_pass.cpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -10,26 +10,24 @@
// unique_lock(mutex_type& m, adopt_lock_t);
+#define BOOST_THREAD_VERSION 4
+
#include <boost/thread/lock_factories.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/detail/lightweight_test.hpp>
-#if ! defined(BOOST_NO_CXX11_AUTO) && ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
int main()
{
boost::mutex m;
m.lock();
- auto lk = boost::make_unique_lock(m, boost::defer_lock);
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)
+ auto
+#else
+ boost::unique_lock<boost::mutex>
+#endif
+ lk = boost::make_unique_lock(m, boost::defer_lock);
BOOST_TEST(lk.mutex() == &m);
BOOST_TEST(lk.owns_lock() == false);
return boost::report_errors();
}
-
-#else
-int main()
-{
- return boost::report_errors();
-}
-#endif
-
Modified: branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_mutex_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_mutex_pass.cpp (original)
+++ branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_mutex_pass.cpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -8,12 +8,15 @@
// template <class Mutex>
// unique_lock<Mutex> make_unique_lock(Mutex&);
+#define BOOST_THREAD_VERSION 4
+
+#include <boost/thread/detail/config.hpp>
#include <boost/thread/lock_factories.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
#include <boost/detail/lightweight_test.hpp>
-#if ! defined(BOOST_NO_CXX11_AUTO) && ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+//#if ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
boost::mutex m;
@@ -33,7 +36,13 @@
time_point t0 = Clock::now();
time_point t1;
{
- auto&& _ = boost::make_unique_lock(m); (void)_;
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)
+ auto
+#else
+ boost::unique_lock<boost::mutex>
+#endif
+ //&&
+ _ = boost::make_unique_lock(m); (void)_;
t1 = Clock::now();
}
ns d = t1 - t0 - ms(250);
@@ -43,7 +52,13 @@
//time_point t0 = Clock::now();
//time_point t1;
{
- auto _ = boost::make_unique_lock(m); (void)_;
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)
+ auto
+#else
+ boost::unique_lock<boost::mutex>
+#endif
+ //&&
+ _ = boost::make_unique_lock(m); (void)_;
//t1 = Clock::now();
}
//ns d = t1 - t0 - ms(250);
@@ -65,10 +80,10 @@
return boost::report_errors();
}
-#else
-int main()
-{
- return boost::report_errors();
-}
-#endif
+//#else
+//int main()
+//{
+// return boost::report_errors();
+//}
+//#endif
Modified: branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_try_to_lock_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_try_to_lock_pass.cpp (original)
+++ branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_lock_try_to_lock_pass.cpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -8,13 +8,14 @@
// template <class Mutex> class unique_lock;
// unique_lock<Mutex> make_unique_lock(Mutex&, try_to_lock_t);
+#define BOOST_THREAD_VERSION 4
+
+
#include <boost/thread/lock_factories.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
#include <boost/detail/lightweight_test.hpp>
-#if ! defined(BOOST_NO_CXX11_AUTO) && ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
-
boost::mutex m;
#if defined BOOST_THREAD_USES_CHRONO
@@ -31,20 +32,40 @@
#if defined BOOST_THREAD_USES_CHRONO
time_point t0 = Clock::now();
{
- auto lk = boost::make_unique_lock(m, boost::try_to_lock);
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)
+ auto
+#else
+ boost::unique_lock<boost::mutex>
+#endif
+ lk = boost::make_unique_lock(m, boost::try_to_lock);
BOOST_TEST(lk.owns_lock() == false);
}
{
- auto lk = boost::make_unique_lock(m, boost::try_to_lock);
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)
+ auto
+#else
+ boost::unique_lock<boost::mutex>
+#endif
+ lk = boost::make_unique_lock(m, boost::try_to_lock);
BOOST_TEST(lk.owns_lock() == false);
}
{
- auto lk = boost::make_unique_lock(m, boost::try_to_lock);
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)
+ auto
+#else
+ boost::unique_lock<boost::mutex>
+#endif
+ lk = boost::make_unique_lock(m, boost::try_to_lock);
BOOST_TEST(lk.owns_lock() == false);
}
while (true)
{
- auto lk = boost::make_unique_lock(m, boost::try_to_lock);
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)
+ auto
+#else
+ boost::unique_lock<boost::mutex>
+#endif
+ lk = boost::make_unique_lock(m, boost::try_to_lock);
if (lk.owns_lock()) break;
}
time_point t1 = Clock::now();
@@ -68,7 +89,12 @@
// }
while (true)
{
- auto lk = boost::make_unique_lock(m, boost::try_to_lock);
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS)
+ auto
+#else
+ boost::unique_lock<boost::mutex>
+#endif
+ lk = boost::make_unique_lock(m, boost::try_to_lock);
if (lk.owns_lock()) break;
}
//time_point t1 = Clock::now();
@@ -91,11 +117,3 @@
return boost::report_errors();
}
-
-#else
-int main()
-{
- return boost::report_errors();
-}
-#endif
-
Modified: branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_locks_mutex_pass.cpp
==============================================================================
--- branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_locks_mutex_pass.cpp (original)
+++ branches/release/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/cons/make_unique_locks_mutex_pass.cpp 2013-01-04 13:40:49 EST (Fri, 04 Jan 2013)
@@ -8,12 +8,14 @@
// template <class Mutex>
// unique_lock<Mutex> make_unique_lock(Mutex&);
+#define BOOST_THREAD_VERSION 4
+
#include <boost/thread/lock_factories.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/thread.hpp>
#include <boost/detail/lightweight_test.hpp>
-#if ! defined(BOOST_NO_CXX11_AUTO) && defined BOOST_NO_CXX11_HDR_TUPLE && ! defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
+#if ! defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && ! defined BOOST_NO_CXX11_HDR_TUPLE && ! defined BOOST_NO_CXX11_RVALUE_REFERENCES
boost::mutex m1;
boost::mutex m2;
@@ -36,7 +38,7 @@
time_point t0 = Clock::now();
time_point t1;
{
- auto&& _ = boost::make_unique_locks(m1,m2,m3);
+ auto&& _ = boost::make_unique_locks(m1,m2,m3); (void)_;
t1 = Clock::now();
}
ns d = t1 - t0 - ms(250);
@@ -46,7 +48,7 @@
//time_point t0 = Clock::now();
//time_point t1;
{
- auto&& _ = boost::make_unique_locks(m1,m2,m3);
+ auto&& _ = boost::make_unique_locks(m1,m2,m3); (void)_;
//t1 = Clock::now();
}
//ns d = t1 - t0 - ms(250);
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