|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r77378 - in trunk/libs/thread: example test test/sync/mutual_exclusion/locks/lock_guard test/sync/mutual_exclusion/locks/shared_lock test/sync/mutual_exclusion/locks/shared_lock/cons test/sync/mutual_exclusion/locks/unique_lock test/sync/mutual_exclusion/locks/upgrade_lock test/sync/mutual_exclusion/locks/upgrade_lock/cons
From: vicente.botet_at_[hidden]
Date: 2012-03-18 14:21:47
Author: viboes
Date: 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
New Revision: 77378
URL: http://svn.boost.org/trac/boost/changeset/77378
Log:
Thread: Make test names shorter + Added some examples of shared mutex and tests
Added:
trunk/libs/thread/example/shared_monitor.cpp (contents, props changed)
trunk/libs/thread/example/shared_mutex.cpp (contents, props changed)
trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/adopt_lock_pass.cpp (contents, props changed)
trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/copy_assign_fail.cpp (contents, props changed)
trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/copy_ctor_fail.cpp (contents, props changed)
trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/default_pass.cpp (contents, props changed)
trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/types_pass.cpp (contents, props changed)
trunk/libs/thread/test/sync/mutual_exclusion/locks/shared_lock/types_pass.cpp (contents, props changed)
trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/types_pass.cpp (contents, props changed)
Text files modified:
trunk/libs/thread/test/Jamfile.v2 | 355 +++++++++++++++++++++------------------
trunk/libs/thread/test/sync/mutual_exclusion/locks/shared_lock/cons/duration_pass.cpp | 3
trunk/libs/thread/test/sync/mutual_exclusion/locks/shared_lock/cons/move_assign_pass.cpp | 8
trunk/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/types_pass.cpp | 25 +-
trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/cons/duration_pass.cpp | 3
trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/cons/move_assign_pass.cpp | 4
trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/cons/time_point_pass.cpp | 8
trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/cons/try_to_lock_pass.cpp | 12
8 files changed, 222 insertions(+), 196 deletions(-)
Added: trunk/libs/thread/example/shared_monitor.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/thread/example/shared_monitor.cpp 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -0,0 +1,136 @@
+// Copyright (C) 2012 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)
+
+#include <iostream>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/shared_mutex.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/chrono/chrono_io.hpp>
+
+#include <cassert>
+#include <vector>
+
+#define EXCLUSIVE 1
+#define SHARED 2
+
+#define MODE SHARED
+
+class A
+{
+#if MODE == EXCLUSIVE
+ typedef boost::mutex mutex_type;
+#elif MODE == SHARED
+ typedef boost::shared_mutex mutex_type;
+#else
+#error MODE not set
+#endif
+ typedef std::vector<double> C;
+ mutable mutex_type mut_;
+ C data_;
+public:
+ A() : data_(10000000) {}
+ A(const A& a);
+ A& operator=(const A& a);
+
+ void compute(const A& x, const A& y);
+};
+
+A::A(const A& a)
+{
+#if MODE == EXCLUSIVE
+ boost::unique_lock<mutex_type> lk(a.mut_);
+#elif MODE == SHARED
+ boost::shared_lock<mutex_type> lk(a.mut_);
+#else
+#error MODE not set
+#endif
+ data_ = a.data_;
+}
+
+A&
+A::operator=(const A& a)
+{
+ if (this != &a)
+ {
+ boost::unique_lock<mutex_type> lk1(mut_, boost::defer_lock);
+#if MODE == EXCLUSIVE
+ boost::unique_lock<mutex_type> lk2(a.mut_, boost::defer_lock);
+#elif MODE == SHARED
+ boost::shared_lock<mutex_type> lk2(a.mut_, boost::defer_lock);
+#else
+#error MODE not set
+#endif
+ boost::lock(lk1, lk2);
+ data_ = a.data_;
+ }
+ return *this;
+}
+
+void
+A::compute(const A& x, const A& y)
+{
+ boost::unique_lock<mutex_type> lk1(mut_, boost::defer_lock);
+#if MODE == EXCLUSIVE
+ boost::unique_lock<mutex_type> lk2(x.mut_, boost::defer_lock);
+ boost::unique_lock<mutex_type> lk3(y.mut_, boost::defer_lock);
+#elif MODE == SHARED
+ boost::shared_lock<mutex_type> lk2(x.mut_, boost::defer_lock);
+ boost::shared_lock<mutex_type> lk3(y.mut_, boost::defer_lock);
+#else
+#error MODE not set
+#endif
+ boost::lock(lk1, lk2, lk3);
+ assert(data_.size() == x.data_.size());
+ assert(data_.size() == y.data_.size());
+ for (unsigned i = 0; i < data_.size(); ++i)
+ data_[i] = (x.data_[i] + y.data_[i]) / 2;
+}
+
+A a1;
+A a2;
+
+void test_s()
+{
+ A la3 = a1;
+ for (int i = 0; i < 150; ++i)
+ {
+ la3.compute(a1, a2);
+ }
+}
+
+void test_w()
+{
+ A la3 = a1;
+ for (int i = 0; i < 10; ++i)
+ {
+ la3.compute(a1, a2);
+ a1 = la3;
+ a2 = la3;
+// boost::this_thread::sleep_for(boost::chrono::seconds(1));
+ }
+}
+
+int main()
+{
+ typedef boost::chrono::high_resolution_clock Clock;
+ typedef boost::chrono::duration<double> sec;
+ Clock::time_point t0 = Clock::now();
+ std::vector<boost::thread*> v;
+ boost::thread thw(test_w);
+ v.push_back(&thw);
+ boost::thread thr0(test_w);
+ v.push_back(&thr0);
+ boost::thread thr1(test_w);
+ v.push_back(&thr1);
+ boost::thread thr2(test_w);
+ v.push_back(&thr2);
+ boost::thread thr3(test_w);
+ v.push_back(&thr3);
+ for (int i = 0; i < v.size(); ++i)
+ v[i]->join();
+ Clock::time_point t1 = Clock::now();
+ std::cout << sec(t1-t0) << '\n';
+ return 0;
+}
Added: trunk/libs/thread/example/shared_mutex.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/thread/example/shared_mutex.cpp 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -0,0 +1,722 @@
+// Copyright (C) 2012 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)
+
+#define BOOST_THREAD_SHARED_MUTEX_PROVIDES_UPWARDS_CONVERSION
+#define BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
+
+#include <iostream>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/shared_mutex.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/chrono/chrono_io.hpp>
+
+#include <cassert>
+#include <vector>
+
+enum {reading, writing};
+int state = reading;
+
+#if 1
+
+boost::mutex&
+cout_mut()
+{
+ static boost::mutex m;
+ return m;
+}
+
+void
+print(const char* tag, unsigned count, char ch)
+{
+ boost::lock_guard<boost::mutex> _(cout_mut());
+ std::cout << tag << count << ch;
+}
+
+#elif 0
+
+boost::recursive_mutex&
+cout_mut()
+{
+ static boost::recursive_mutex m;
+ return m;
+}
+
+void print() {}
+
+template <class A0, class ...Args>
+void
+print(const A0& a0, const Args& ...args)
+{
+ boost::lock_guard<boost::recursive_mutex> _(cout_mut());
+ std::cout << a0;
+ print(args...);
+}
+
+#else
+
+template <class A0, class A1, class A2>
+void
+print(const A0&, const A1& a1, const A2&)
+{
+ assert(a1 > 10000);
+}
+
+#endif
+
+namespace S
+{
+
+boost::shared_mutex mut;
+
+void reader()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ mut.lock_shared();
+ assert(state == reading);
+ ++count;
+ mut.unlock_shared();
+ }
+ print("reader = ", count, '\n');
+}
+
+void writer()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ mut.lock();
+ state = writing;
+ assert(state == writing);
+ state = reading;
+ ++count;
+ mut.unlock();
+ }
+ print("writer = ", count, '\n');
+}
+
+void try_reader()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ if (mut.try_lock_shared())
+ {
+ assert(state == reading);
+ ++count;
+ mut.unlock_shared();
+ }
+ }
+ print("try_reader = ", count, '\n');
+}
+
+void try_writer()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ if (mut.try_lock())
+ {
+ state = writing;
+ assert(state == writing);
+ state = reading;
+ ++count;
+ mut.unlock();
+ }
+ }
+ print("try_writer = ", count, '\n');
+}
+
+void try_for_reader()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ if (mut.try_lock_shared_for(boost::chrono::microseconds(5)))
+ {
+ assert(state == reading);
+ ++count;
+ mut.unlock_shared();
+ }
+ }
+ print("try_for_reader = ", count, '\n');
+}
+
+void try_for_writer()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ if (mut.try_lock_for(boost::chrono::microseconds(5)))
+ {
+ state = writing;
+ assert(state == writing);
+ state = reading;
+ ++count;
+ mut.unlock();
+ }
+ }
+ print("try_for_writer = ", count, '\n');
+}
+
+void
+test_shared_mutex()
+{
+ {
+ boost::thread t1(reader);
+ boost::thread t2(writer);
+ boost::thread t3(reader);
+ t1.join();
+ t2.join();
+ t3.join();
+ }
+ {
+ boost::thread t1(try_reader);
+ boost::thread t2(try_writer);
+ boost::thread t3(try_reader);
+ t1.join();
+ t2.join();
+ t3.join();
+ }
+ {
+ boost::thread t1(try_for_reader);
+ boost::thread t2(try_for_writer);
+ boost::thread t3(try_for_reader);
+ t1.join();
+ t2.join();
+ t3.join();
+ }
+}
+
+}
+
+namespace U
+{
+
+boost::upgrade_mutex mut;
+
+void reader()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ mut.lock_shared();
+ assert(state == reading);
+ ++count;
+ mut.unlock_shared();
+ }
+ print("reader = ", count, '\n');
+}
+
+void writer()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ mut.lock();
+ state = writing;
+ assert(state == writing);
+ state = reading;
+ ++count;
+ mut.unlock();
+ }
+ print("writer = ", count, '\n');
+}
+
+void try_reader()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ if (mut.try_lock_shared())
+ {
+ assert(state == reading);
+ ++count;
+ mut.unlock_shared();
+ }
+ }
+ print("try_reader = ", count, '\n');
+}
+
+void try_writer()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ if (mut.try_lock())
+ {
+ state = writing;
+ assert(state == writing);
+ state = reading;
+ ++count;
+ mut.unlock();
+ }
+ }
+ print("try_writer = ", count, '\n');
+}
+
+void try_for_reader()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ if (mut.try_lock_shared_for(boost::chrono::microseconds(5)))
+ {
+ assert(state == reading);
+ ++count;
+ mut.unlock_shared();
+ }
+ }
+ print("try_for_reader = ", count, '\n');
+}
+
+void try_for_writer()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ if (mut.try_lock_for(boost::chrono::microseconds(5)))
+ {
+ state = writing;
+ assert(state == writing);
+ state = reading;
+ ++count;
+ mut.unlock();
+ }
+ }
+ print("try_for_writer = ", count, '\n');
+}
+
+void upgradable()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ mut.lock_upgrade();
+ assert(state == reading);
+ ++count;
+ mut.unlock_upgrade();
+ }
+ print("upgradable = ", count, '\n');
+}
+
+void try_upgradable()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ if (mut.try_lock_upgrade())
+ {
+ assert(state == reading);
+ ++count;
+ mut.unlock_upgrade();
+ }
+ }
+ print("try_upgradable = ", count, '\n');
+}
+
+void try_for_upgradable()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ if (mut.try_lock_upgrade_for(boost::chrono::microseconds(5)))
+ {
+ assert(state == reading);
+ ++count;
+ mut.unlock_upgrade();
+ }
+ }
+ print("try_for_upgradable = ", count, '\n');
+}
+
+void clockwise()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ mut.lock_shared();
+ assert(state == reading);
+ if (mut.try_unlock_shared_and_lock())
+ {
+ state = writing;
+ }
+ else if (mut.try_unlock_shared_and_lock_upgrade())
+ {
+ assert(state == reading);
+ mut.unlock_upgrade_and_lock();
+ state = writing;
+ }
+ else
+ {
+ mut.unlock_shared();
+ continue;
+ }
+ assert(state == writing);
+ state = reading;
+ mut.unlock_and_lock_upgrade();
+ assert(state == reading);
+ mut.unlock_upgrade_and_lock_shared();
+ assert(state == reading);
+ mut.unlock_shared();
+ ++count;
+ }
+ print("clockwise = ", count, '\n');
+}
+
+void counter_clockwise()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ mut.lock_upgrade();
+ assert(state == reading);
+ mut.unlock_upgrade_and_lock();
+ assert(state == reading);
+ state = writing;
+ assert(state == writing);
+ state = reading;
+ mut.unlock_and_lock_shared();
+ assert(state == reading);
+ mut.unlock_shared();
+ ++count;
+ }
+ print("counter_clockwise = ", count, '\n');
+}
+
+void try_clockwise()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ if (mut.try_lock_shared())
+ {
+ assert(state == reading);
+ if (mut.try_unlock_shared_and_lock())
+ {
+ state = writing;
+ }
+ else if (mut.try_unlock_shared_and_lock_upgrade())
+ {
+ assert(state == reading);
+ mut.unlock_upgrade_and_lock();
+ state = writing;
+ }
+ else
+ {
+ mut.unlock_shared();
+ continue;
+ }
+ assert(state == writing);
+ state = reading;
+ mut.unlock_and_lock_upgrade();
+ assert(state == reading);
+ mut.unlock_upgrade_and_lock_shared();
+ assert(state == reading);
+ mut.unlock_shared();
+ ++count;
+ }
+ }
+ print("try_clockwise = ", count, '\n');
+}
+
+void try_for_clockwise()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ if (mut.try_lock_shared_for(boost::chrono::microseconds(5)))
+ {
+ assert(state == reading);
+ if (mut.try_unlock_shared_and_lock_for(boost::chrono::microseconds(5)))
+ {
+ state = writing;
+ }
+ else if (mut.try_unlock_shared_and_lock_upgrade_for(boost::chrono::microseconds(5)))
+ {
+ assert(state == reading);
+ mut.unlock_upgrade_and_lock();
+ state = writing;
+ }
+ else
+ {
+ mut.unlock_shared();
+ continue;
+ }
+ assert(state == writing);
+ state = reading;
+ mut.unlock_and_lock_upgrade();
+ assert(state == reading);
+ mut.unlock_upgrade_and_lock_shared();
+ assert(state == reading);
+ mut.unlock_shared();
+ ++count;
+ }
+ }
+ print("try_for_clockwise = ", count, '\n');
+}
+
+void try_counter_clockwise()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ if (mut.try_lock_upgrade())
+ {
+ assert(state == reading);
+ if (mut.try_unlock_upgrade_and_lock())
+ {
+ assert(state == reading);
+ state = writing;
+ assert(state == writing);
+ state = reading;
+ mut.unlock_and_lock_shared();
+ assert(state == reading);
+ mut.unlock_shared();
+ ++count;
+ }
+ else
+ {
+ mut.unlock_upgrade();
+ }
+ }
+ }
+ print("try_counter_clockwise = ", count, '\n');
+}
+
+void try_for_counter_clockwise()
+{
+ typedef boost::chrono::steady_clock Clock;
+ unsigned count = 0;
+ Clock::time_point until = Clock::now() + boost::chrono::seconds(3);
+ while (Clock::now() < until)
+ {
+ if (mut.try_lock_upgrade_for(boost::chrono::microseconds(5)))
+ {
+ assert(state == reading);
+ if (mut.try_unlock_upgrade_and_lock_for(boost::chrono::microseconds(5)))
+ {
+ assert(state == reading);
+ state = writing;
+ assert(state == writing);
+ state = reading;
+ mut.unlock_and_lock_shared();
+ assert(state == reading);
+ mut.unlock_shared();
+ ++count;
+ }
+ else
+ {
+ mut.unlock_upgrade();
+ }
+ }
+ }
+ print("try_for_counter_clockwise = ", count, '\n');
+}
+
+void
+test_upgrade_mutex()
+{
+ {
+ boost::thread t1(reader);
+ boost::thread t2(writer);
+ boost::thread t3(reader);
+ t1.join();
+ t2.join();
+ t3.join();
+ }
+ {
+ boost::thread t1(try_reader);
+ boost::thread t2(try_writer);
+ boost::thread t3(try_reader);
+ t1.join();
+ t2.join();
+ t3.join();
+ }
+ {
+ boost::thread t1(try_for_reader);
+ boost::thread t2(try_for_writer);
+ boost::thread t3(try_for_reader);
+ t1.join();
+ t2.join();
+ t3.join();
+ }
+ {
+ boost::thread t1(reader);
+ boost::thread t2(writer);
+ boost::thread t3(upgradable);
+ t1.join();
+ t2.join();
+ t3.join();
+ }
+ {
+ boost::thread t1(reader);
+ boost::thread t2(writer);
+ boost::thread t3(try_upgradable);
+ t1.join();
+ t2.join();
+ t3.join();
+ }
+ {
+ boost::thread t1(reader);
+ boost::thread t2(writer);
+ boost::thread t3(try_for_upgradable);
+ t1.join();
+ t2.join();
+ t3.join();
+ }
+ {
+ state = reading;
+ boost::thread t1(clockwise);
+ boost::thread t2(counter_clockwise);
+ boost::thread t3(clockwise);
+ boost::thread t4(counter_clockwise);
+ t1.join();
+ t2.join();
+ t3.join();
+ t4.join();
+ }
+ {
+ state = reading;
+ boost::thread t1(try_clockwise);
+ boost::thread t2(try_counter_clockwise);
+ t1.join();
+ t2.join();
+ }
+ {
+ state = reading;
+ boost::thread t1(try_for_clockwise);
+ boost::thread t2(try_for_counter_clockwise);
+ t1.join();
+ t2.join();
+ }
+}
+
+}
+
+namespace Assignment
+{
+
+class A
+{
+ typedef boost::upgrade_mutex mutex_type;
+ typedef boost::shared_lock<mutex_type> SharedLock;
+ typedef boost::upgrade_lock<mutex_type> UpgradeLock;
+ typedef boost::unique_lock<mutex_type> Lock;
+
+ mutable mutex_type mut_;
+ std::vector<double> data_;
+
+public:
+
+ A(const A& a)
+ {
+ SharedLock _(a.mut_);
+ data_ = a.data_;
+ }
+
+ A& operator=(const A& a)
+ {
+ if (this != &a)
+ {
+ Lock this_lock(mut_, boost::defer_lock);
+ SharedLock that_lock(a.mut_, boost::defer_lock);
+ boost::lock(this_lock, that_lock);
+ data_ = a.data_;
+ }
+ return *this;
+ }
+
+ void swap(A& a)
+ {
+ Lock this_lock(mut_, boost::defer_lock);
+ Lock that_lock(a.mut_, boost::defer_lock);
+ boost::lock(this_lock, that_lock);
+ data_.swap(a.data_);
+ }
+
+ void average(A& a)
+ {
+ assert(data_.size() == a.data_.size());
+ assert(this != &a);
+
+ Lock this_lock(mut_, boost::defer_lock);
+ UpgradeLock share_that_lock(a.mut_, boost::defer_lock);
+ boost::lock(this_lock, share_that_lock);
+
+ for (unsigned i = 0; i < data_.size(); ++i)
+ data_[i] = (data_[i] + a.data_[i]) / 2;
+
+ SharedLock share_this_lock(boost::move(this_lock));
+ Lock that_lock(boost::move(share_that_lock));
+ a.data_ = data_;
+ }
+};
+
+} // Assignment
+
+void temp()
+{
+ using namespace boost;
+ static upgrade_mutex mut;
+ unique_lock<upgrade_mutex> ul(mut);
+ shared_lock<upgrade_mutex> sl;
+ sl = shared_lock<upgrade_mutex>(boost::move(ul));
+}
+
+int main()
+{
+ typedef boost::chrono::high_resolution_clock Clock;
+ typedef boost::chrono::duration<double> sec;
+ Clock::time_point t0 = Clock::now();
+
+ S::test_shared_mutex();
+ U::test_upgrade_mutex();
+ Clock::time_point t1 = Clock::now();
+ std::cout << sec(t1 - t0) << '\n';
+ return 0;
+}
+
Modified: trunk/libs/thread/test/Jamfile.v2
==============================================================================
--- trunk/libs/thread/test/Jamfile.v2 (original)
+++ trunk/libs/thread/test/Jamfile.v2 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -80,9 +80,9 @@
[ thread-run test_shared_mutex_timed_locks.cpp ]
[ thread-run test_shared_mutex_timed_locks_chrono.cpp ]
#uncomment the following once these works on windows
- #[ thread-run test_v2_shared_mutex.cpp ]
- #[ thread-run test_v2_shared_mutex_part_2.cpp ]
- #[ thread-run test_v2_shared_mutex_timed_locks.cpp ]
+ [ thread-run test_v2_shared_mutex.cpp ]
+ [ thread-run test_v2_shared_mutex_part_2.cpp ]
+ [ thread-run test_v2_shared_mutex_timed_locks.cpp ]
[ thread-run test_lock_concept.cpp ]
[ thread-run test_generic_locks.cpp ]
[ thread-run test_futures.cpp ]
@@ -122,188 +122,215 @@
#explicit conditions ;
test-suite conditions
:
- [ thread-compile-fail-V2 ./sync/conditions/condition_variable/assign_fail.cpp : : conditions__condition_variable__assign_fail ]
- [ thread-compile-fail-V2 ./sync/conditions/condition_variable/copy_fail.cpp : : conditions__condition_variable__copy_fail ]
- [ thread-run2 ./sync/conditions/condition_variable/default_pass.cpp : conditions__condition_variable__default_pass ]
- [ thread-run2 ./sync/conditions/condition_variable/dtor_pass.cpp : conditions__condition_variable__dtor_pass ]
- [ thread-run2 ./sync/conditions/condition_variable/native_handle_pass.cpp : conditions__condition_variable__native_handle_pass ]
- [ thread-run2 ./sync/conditions/condition_variable/wait_for_pass.cpp : conditions__condition_variable__wait_for_pass ]
- [ thread-run2 ./sync/conditions/condition_variable/wait_for_pred_pass.cpp : conditions__condition_variable__wait_for_pred_pass ]
- [ thread-run2 ./sync/conditions/condition_variable/wait_until_pass.cpp : conditions__condition_variable__wait_until_pass ]
- [ thread-run2 ./sync/conditions/condition_variable/wait_until_pred_pass.cpp : conditions__condition_variable__wait_until_pred_pass ]
-
- [ thread-compile-fail-V2 ./sync/conditions/condition_variable_any/assign_fail.cpp : : conditions__condition_variable_any__assign_fail ]
- [ thread-compile-fail-V2 ./sync/conditions/condition_variable_any/copy_fail.cpp : : conditions__condition_variable_any__copy_fail ]
- [ thread-run2 ./sync/conditions/condition_variable_any/default_pass.cpp : conditions__condition_variable_any__default_pass ]
- [ thread-run2 ./sync/conditions/condition_variable_any/dtor_pass.cpp : conditions__condition_variable_any__dtor_pass ]
- [ thread-run2 ./sync/conditions/condition_variable_any/wait_for_pass.cpp : conditions__condition_variable_any__wait_for_pass ]
- [ thread-run2 ./sync/conditions/condition_variable_any/wait_for_pred_pass.cpp : conditions__condition_variable_any__wait_for_pred_pass ]
- [ thread-run2 ./sync/conditions/condition_variable_any/wait_until_pass.cpp : conditions__condition_variable_any__wait_until_pass ]
- [ thread-run2 ./sync/conditions/condition_variable_any/wait_until_pred_pass.cpp : conditions__condition_variable_any__wait_until_pred_pass ]
- [ thread-run2 ./sync/conditions/cv_status/cv_status_pass.cpp : conditions__cv_status__cv_status_pass ]
+ [ thread-compile-fail-V2 ./sync/conditions/condition_variable/assign_fail.cpp : : conditions__condition_variable__assign_f ]
+ [ thread-compile-fail-V2 ./sync/conditions/condition_variable/copy_fail.cpp : : conditions__condition_variable__copy_f ]
+ [ thread-run2 ./sync/conditions/condition_variable/default_pass.cpp : conditions__condition_variable__default_p ]
+ [ thread-run2 ./sync/conditions/condition_variable/dtor_pass.cpp : conditions__condition_variable__dtor_p ]
+ [ thread-run2 ./sync/conditions/condition_variable/native_handle_pass.cpp : conditions__condition_variable__native_handle_p ]
+ [ thread-run2 ./sync/conditions/condition_variable/wait_for_pass.cpp : conditions__condition_variable__wait_for_p ]
+ [ thread-run2 ./sync/conditions/condition_variable/wait_for_pred_pass.cpp : conditions__condition_variable__wait_for_pred_p ]
+ [ thread-run2 ./sync/conditions/condition_variable/wait_until_pass.cpp : conditions__condition_variable__wait_until_p ]
+ [ thread-run2 ./sync/conditions/condition_variable/wait_until_pred_pass.cpp : conditions__condition_variable__wait_until_pred_p ]
+
+ [ thread-compile-fail-V2 ./sync/conditions/condition_variable_any/assign_fail.cpp : : conditions__condition_variable_any__assign_f ]
+ [ thread-compile-fail-V2 ./sync/conditions/condition_variable_any/copy_fail.cpp : : conditions__condition_variable_any__copy_f ]
+ [ thread-run2 ./sync/conditions/condition_variable_any/default_pass.cpp : conditions__condition_variable_any__default_p ]
+ [ thread-run2 ./sync/conditions/condition_variable_any/dtor_pass.cpp : conditions__condition_variable_any__dtor_p ]
+ [ thread-run2 ./sync/conditions/condition_variable_any/wait_for_pass.cpp : conditions__condition_variable_any__wait_for_p ]
+ [ thread-run2 ./sync/conditions/condition_variable_any/wait_for_pred_pass.cpp : conditions__condition_variable_any__wait_for_pred_p ]
+ [ thread-run2 ./sync/conditions/condition_variable_any/wait_until_pass.cpp : conditions__condition_variable_any__wait_until_p ]
+ [ thread-run2 ./sync/conditions/condition_variable_any/wait_until_pred_pass.cpp : conditions__condition_variable_any__wait_until_pred_p ]
+ [ thread-run2 ./sync/conditions/cv_status/cv_status_pass.cpp : conditions__cv_status__cv_status_p ]
;
#explicit futures ;
test-suite futures
:
- # [ thread-run2 ./sync/futures/async/async_pass.cpp : futures__async__async_pass ]
- [ thread-run2 ./sync/futures/promise/default_pass.cpp : futures__promise__default_pass ]
- [ thread-run2 ./sync/futures/promise/dtor_pass.cpp : futures__promise__dtor_pass ]
- [ thread-run2 ./sync/futures/promise/get_future_pass.cpp : futures__promise__get_future_pass ]
+ # [ thread-run2 ./sync/futures/async/async_pass.cpp : futures__async__async_p ]
+ [ thread-run2 ./sync/futures/promise/default_pass.cpp : futures__promise__default_p ]
+ [ thread-run2 ./sync/futures/promise/dtor_pass.cpp : futures__promise__dtor_p ]
+ [ thread-run2 ./sync/futures/promise/get_future_pass.cpp : futures__promise__get_future_p ]
;
#explicit mutual_exclusion ;
test-suite mutual_exclusion
:
-
- [ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/unique_lock/cons/copy_assign_fail.cpp : : mutual_exclusion__locks__unique_lock__cons__copy_assign_fail ]
- [ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/unique_lock/cons/copy_ctor_fail.cpp : : mutual_exclusion__locks__unique_lock__cons__copy_ctor_fail ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/adopt_lock_pass.cpp : mutual_exclusion__locks__unique_lock__cons__adopt_lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/default_pass.cpp : mutual_exclusion__locks__unique_lock__cons__default_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/defer_lock_pass.cpp : mutual_exclusion__locks__unique_lock__cons__defer_lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/duration_pass.cpp : mutual_exclusion__locks__unique_lock__cons__duration_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_assign_pass.cpp : mutual_exclusion__locks__unique_lock__cons__move_assign_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_ctor_pass.cpp : mutual_exclusion__locks__unique_lock__cons__move_ctor_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/mutex_pass.cpp : mutual_exclusion__locks__unique_lock__cons__mutex_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/time_point_pass.cpp : mutual_exclusion__locks__unique_lock__cons__time_point_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/try_to_lock_pass.cpp : mutual_exclusion__locks__unique_lock__cons__try_to_lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/lock_pass.cpp : mutual_exclusion__locks__unique_lock__locking__lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/try_lock_for_pass.cpp : mutual_exclusion__locks__unique_lock__locking__try_lock_for_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/try_lock_pass.cpp : mutual_exclusion__locks__unique_lock__locking__try_lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/try_lock_until_pass.cpp : mutual_exclusion__locks__unique_lock__locking__try_lock_until_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/unlock_pass.cpp : mutual_exclusion__locks__unique_lock__locking__unlock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/mod/member_swap_pass.cpp : mutual_exclusion__locks__unique_lock__mod__member_swap_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/mod/non_member_swap_pass.cpp : mutual_exclusion__locks__unique_lock__mod__non_member_swap_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/mod/release_pass.cpp : mutual_exclusion__locks__unique_lock__mod__release_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/obs/mutex_pass.cpp : mutual_exclusion__locks__unique_lock__obs__mutex_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/obs/op_bool_pass.cpp : mutual_exclusion__locks__unique_lock__obs__op_bool_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/obs/owns_lock_pass.cpp : mutual_exclusion__locks__unique_lock__obs__owns_lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/types_pass.cpp : mutual_exclusion__locks__unique_lock__types_pass ]
-
- [ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/shared_lock/cons/copy_assign_fail.cpp : : mutual_exclusion__locks__shared_lock__cons__copy_assign_fail ]
- [ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/shared_lock/cons/copy_ctor_fail.cpp : : mutual_exclusion__locks__shared_lock__cons__copy_ctor_fail ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/adopt_lock_pass.cpp : mutual_exclusion__locks__shared_lock__cons__adopt_lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/default_pass.cpp : mutual_exclusion__locks__shared_lock__cons__default_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/defer_lock_pass.cpp : mutual_exclusion__locks__shared_lock__cons__defer_lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/duration_pass.cpp : mutual_exclusion__locks__shared_lock__cons__duration_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/move_assign_pass.cpp : mutual_exclusion__locks__shared_lock__cons__move_assign_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/move_ctor_pass.cpp : mutual_exclusion__locks__shared_lock__cons__move_ctor_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/mutex_pass.cpp : mutual_exclusion__locks__shared_lock__cons__mutex_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/time_point_pass.cpp : mutual_exclusion__locks__shared_lock__cons__time_point_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/try_to_lock_pass.cpp : mutual_exclusion__locks__shared_lock__cons__try_to_lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/lock_pass.cpp : mutual_exclusion__locks__shared_lock__locking__lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/try_lock_for_pass.cpp : mutual_exclusion__locks__shared_lock__locking__try_lock_for_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/try_lock_pass.cpp : mutual_exclusion__locks__shared_lock__locking__try_lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/try_lock_until_pass.cpp : mutual_exclusion__locks__shared_lock__locking__try_lock_until_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/unlock_pass.cpp : mutual_exclusion__locks__shared_lock__locking__unlock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/mod/member_swap_pass.cpp : mutual_exclusion__locks__shared_lock__mod__member_swap_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/mod/non_member_swap_pass.cpp : mutual_exclusion__locks__shared_lock__mod__non_member_swap_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/mod/release_pass.cpp : mutual_exclusion__locks__shared_lock__mod__release_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/obs/mutex_pass.cpp : mutual_exclusion__locks__shared_lock__obs__mutex_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/obs/op_bool_pass.cpp : mutual_exclusion__locks__shared_lock__obs__op_bool_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/obs/owns_lock_pass.cpp : mutual_exclusion__locks__shared_lock__obs__owns_lock_pass ]
-
- [ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/copy_assign_fail.cpp : : mutual_exclusion__locks__upgrade_lock__cons__copy_assign_fail ]
- [ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/copy_ctor_fail.cpp : : mutual_exclusion__locks__upgrade_lock__cons__copy_ctor_fail ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/adopt_lock_pass.cpp : mutual_exclusion__locks__upgrade_lock__cons__adopt_lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/default_pass.cpp : mutual_exclusion__locks__upgrade_lock__cons__default_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/defer_lock_pass.cpp : mutual_exclusion__locks__upgrade_lock__cons__defer_lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/duration_pass.cpp : mutual_exclusion__locks__upgrade_lock__cons__duration_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/move_assign_pass.cpp : mutual_exclusion__locks__upgrade_lock__cons__move_assign_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/move_ctor_pass.cpp : mutual_exclusion__locks__upgrade_lock__cons__move_ctor_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/mutex_pass.cpp : mutual_exclusion__locks__upgrade_lock__cons__mutex_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/time_point_pass.cpp : mutual_exclusion__locks__upgrade_lock__cons__time_point_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/try_to_lock_pass.cpp : mutual_exclusion__locks__upgrade_lock__cons__try_to_lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/lock_pass.cpp : mutual_exclusion__locks__upgrade_lock__locking__lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/try_lock_for_pass.cpp : mutual_exclusion__locks__upgrade_lock__locking__try_lock_for_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/try_lock_pass.cpp : mutual_exclusion__locks__upgrade_lock__locking__try_lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/try_lock_until_pass.cpp : mutual_exclusion__locks__upgrade_lock__locking__try_lock_until_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/unlock_pass.cpp : mutual_exclusion__locks__upgrade_lock__locking__unlock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/mod/member_swap_pass.cpp : mutual_exclusion__locks__upgrade_lock__mod__member_swap_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/mod/non_member_swap_pass.cpp : mutual_exclusion__locks__upgrade_lock__mod__non_member_swap_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/mod/release_pass.cpp : mutual_exclusion__locks__upgrade_lock__mod__release_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/obs/mutex_pass.cpp : mutual_exclusion__locks__upgrade_lock__obs__mutex_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/obs/op_bool_pass.cpp : mutual_exclusion__locks__upgrade_lock__obs__op_bool_pass ]
- [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/obs/owns_lock_pass.cpp : mutual_exclusion__locks__upgrade_lock__obs__owns_lock_pass ]
-
-
- [ thread-compile-fail-V2 ./sync/mutual_exclusion/mutex/assign_fail.cpp : : mutual_exclusion__mutex__assign_fail ]
- [ thread-compile-fail-V2 ./sync/mutual_exclusion/mutex/copy_fail.cpp : : mutual_exclusion__mutex__copy_fail ]
- [ thread-run2 ./sync/mutual_exclusion/mutex/default_pass.cpp : mutual_exclusion__mutex__default_pass ]
- [ thread-run2 ./sync/mutual_exclusion/mutex/lock_pass.cpp : mutual_exclusion__mutex__lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/mutex/native_handle_pass.cpp : mutual_exclusion__mutex__native_handle_pass ]
- [ thread-run2 ./sync/mutual_exclusion/mutex/try_lock_pass.cpp : mutual_exclusion__mutex__try_lock_pass ]
-
- [ thread-compile-fail-V2 ./sync/mutual_exclusion/recursive_mutex/assign_fail.cpp : : mutual_exclusion__recursive_mutex__assign_fail ]
- [ thread-compile-fail-V2 ./sync/mutual_exclusion/recursive_mutex/copy_fail.cpp : : mutual_exclusion__recursive_mutex__copy_fail ]
- [ thread-run2 ./sync/mutual_exclusion/recursive_mutex/default_pass.cpp : mutual_exclusion__recursive_mutex__default_pass ]
- [ thread-run2 ./sync/mutual_exclusion/recursive_mutex/lock_pass.cpp : mutual_exclusion__recursive_mutex__lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/recursive_mutex/native_handle_pass.cpp : mutual_exclusion__recursive_mutex__native_handle_pass ]
- [ thread-run2 ./sync/mutual_exclusion/recursive_mutex/try_lock_pass.cpp : mutual_exclusion__recursive_mutex__try_lock_pass ]
-
- [ thread-compile-fail-V2 ./sync/mutual_exclusion/recursive_timed_mutex/assign_fail.cpp : : mutual_exclusion__recursive_timed_mutex__assign_fail ]
- [ thread-compile-fail-V2 ./sync/mutual_exclusion/recursive_timed_mutex/copy_fail.cpp : : mutual_exclusion__recursive_timed_mutex__copy_fail ]
- [ thread-run2 ./sync/mutual_exclusion/recursive_timed_mutex/default_pass.cpp : mutual_exclusion__recursive_timed_mutex__default_pass ]
- [ thread-run2 ./sync/mutual_exclusion/recursive_timed_mutex/lock_pass.cpp : mutual_exclusion__recursive_timed_mutex__lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/recursive_timed_mutex/native_handle_pass.cpp : mutual_exclusion__recursive_timed_mutex__native_handle_pass ]
- [ thread-run2 ./sync/mutual_exclusion/recursive_timed_mutex/try_lock_for_pass.cpp : mutual_exclusion__recursive_timed_mutex__try_lock_for_pass ]
- [ thread-run2 ./sync/mutual_exclusion/recursive_timed_mutex/try_lock_pass.cpp : mutual_exclusion__recursive_timed_mutex__try_lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/recursive_timed_mutex/try_lock_until_pass.cpp : mutual_exclusion__recursive_timed_mutex__try_lock_until_pass ]
-
- [ thread-compile-fail-V2 ./sync/mutual_exclusion/timed_mutex/assign_fail.cpp : : mutual_exclusion__timed_mutex__assign_fail ]
- [ thread-compile-fail-V2 ./sync/mutual_exclusion/timed_mutex/copy_fail.cpp : : mutual_exclusion__timed_mutex__copy_fail ]
- [ thread-run2 ./sync/mutual_exclusion/timed_mutex/default_pass.cpp : mutual_exclusion__timed_mutex__default_pass ]
- [ thread-run2 ./sync/mutual_exclusion/timed_mutex/lock_pass.cpp : mutual_exclusion__timed_mutex__lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/timed_mutex/native_handle_pass.cpp : mutual_exclusion__timed_mutex__native_handle_pass ]
- [ thread-run2 ./sync/mutual_exclusion/timed_mutex/try_lock_for_pass.cpp : mutual_exclusion__timed_mutex__try_lock_for_pass ]
- [ thread-run2 ./sync/mutual_exclusion/timed_mutex/try_lock_pass.cpp : mutual_exclusion__timed_mutex__try_lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/timed_mutex/try_lock_until_pass.cpp : mutual_exclusion__timed_mutex__try_lock_until_pass ]
-
- [ thread-compile-fail-V2 ./sync/mutual_exclusion/shared_mutex/assign_fail.cpp : : mutual_exclusion__shared_mutex__assign_fail ]
- [ thread-compile-fail-V2 ./sync/mutual_exclusion/shared_mutex/copy_fail.cpp : : mutual_exclusion__shared_mutex__copy_fail ]
- [ thread-run2 ./sync/mutual_exclusion/shared_mutex/default_pass.cpp : mutual_exclusion__shared_mutex__default_pass ]
- [ thread-run2 ./sync/mutual_exclusion/shared_mutex/lock_pass.cpp : mutual_exclusion__shared_mutex__lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/shared_mutex/try_lock_for_pass.cpp : mutual_exclusion__shared_mutex__try_lock_for_pass ]
- [ thread-run2 ./sync/mutual_exclusion/shared_mutex/try_lock_pass.cpp : mutual_exclusion__shared_mutex__try_lock_pass ]
- [ thread-run2 ./sync/mutual_exclusion/shared_mutex/try_lock_until_pass.cpp : mutual_exclusion__shared_mutex__try_lock_until_pass ]
+ #uncomment the following once these works on windows
+ #[ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/lock_guard/copy_assign_fail.cpp : : lock_guard__cons__copy_assign_f ]
+ #[ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/lock_guard/copy_ctor_fail.cpp : : lock_guard__cons__copy_ctor_f ]
+ #[ thread-run2 ./sync/mutual_exclusion/locks/lock_guard/adopt_lock_pass.cpp : lock_guard__cons__adopt_lock_p ]
+ #[ thread-run2 ./sync/mutual_exclusion/locks/lock_guard/default_pass.cpp : lock_guard__cons__default_p ]
+ #[ thread-run2 ./sync/mutual_exclusion/locks/lock_guard/types_pass.cpp : lock_guard__types_p ]
+
+ [ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/unique_lock/cons/copy_assign_fail.cpp : : unique_lock__cons__copy_assign_f ]
+ [ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/unique_lock/cons/copy_ctor_fail.cpp : : unique_lock__cons__copy_ctor_f ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/adopt_lock_pass.cpp : unique_lock__cons__adopt_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/default_pass.cpp : unique_lock__cons__default_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/defer_lock_pass.cpp : unique_lock__cons__defer_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/duration_pass.cpp : unique_lock__cons__duration_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_assign_pass.cpp : unique_lock__cons__move_assign_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_ctor_pass.cpp : unique_lock__cons__move_ctor_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/mutex_pass.cpp : unique_lock__cons__mutex_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/time_point_pass.cpp : unique_lock__cons__time_point_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/try_to_lock_pass.cpp : unique_lock__cons__try_to_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/lock_pass.cpp : unique_lock__locking__lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/try_lock_for_pass.cpp : unique_lock__locking__try_lock_for_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/try_lock_pass.cpp : unique_lock__locking__try_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/try_lock_until_pass.cpp : unique_lock__locking__try_lock_until_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/locking/unlock_pass.cpp : unique_lock__locking__unlock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/mod/member_swap_pass.cpp : unique_lock__mod__member_swap_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/mod/non_member_swap_pass.cpp : unique_lock__mod__non_member_swap_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/mod/release_pass.cpp : unique_lock__mod__release_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/obs/mutex_pass.cpp : unique_lock__obs__mutex_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/obs/op_bool_pass.cpp : unique_lock__obs__op_bool_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/obs/owns_lock_pass.cpp : unique_lock__obs__owns_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/types_pass.cpp : unique_lock__types_p ]
+
+ [ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/shared_lock/cons/copy_assign_fail.cpp : : shared_lock__cons__copy_assign_f ]
+ [ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/shared_lock/cons/copy_ctor_fail.cpp : : shared_lock__cons__copy_ctor_f ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/adopt_lock_pass.cpp : shared_lock__cons__adopt_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/default_pass.cpp : shared_lock__cons__default_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/defer_lock_pass.cpp : shared_lock__cons__defer_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/duration_pass.cpp : shared_lock__cons__duration_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/move_assign_pass.cpp : shared_lock__cons__move_assign_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/move_ctor_pass.cpp : shared_lock__cons__move_ctor_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/mutex_pass.cpp : shared_lock__cons__mutex_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/time_point_pass.cpp : shared_lock__cons__time_point_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/cons/try_to_lock_pass.cpp : shared_lock__cons__try_to_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/lock_pass.cpp : shared_lock__locking__lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/try_lock_for_pass.cpp : shared_lock__locking__try_lock_for_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/try_lock_pass.cpp : shared_lock__locking__try_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/try_lock_until_pass.cpp : shared_lock__locking__try_lock_until_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/locking/unlock_pass.cpp : shared_lock__locking__unlock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/mod/member_swap_pass.cpp : shared_lock__mod__member_swap_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/mod/non_member_swap_pass.cpp : shared_lock__mod__non_member_swap_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/mod/release_pass.cpp : shared_lock__mod__release_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/obs/mutex_pass.cpp : shared_lock__obs__mutex_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/obs/op_bool_pass.cpp : shared_lock__obs__op_bool_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/obs/owns_lock_pass.cpp : shared_lock__obs__owns_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/shared_lock/types_pass.cpp : shared_lock__types_p ]
+
+ [ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/copy_assign_fail.cpp : : upgrade_lock__cons__copy_assign_f ]
+ [ thread-compile-fail-V2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/copy_ctor_fail.cpp : : upgrade_lock__cons__copy_ctor_f ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/adopt_lock_pass.cpp : upgrade_lock__cons__adopt_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/default_pass.cpp : upgrade_lock__cons__default_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/defer_lock_pass.cpp : upgrade_lock__cons__defer_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/duration_pass.cpp : upgrade_lock__cons__duration_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/move_assign_pass.cpp : upgrade_lock__cons__move_assign_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/move_ctor_pass.cpp : upgrade_lock__cons__move_ctor_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/mutex_pass.cpp : upgrade_lock__cons__mutex_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/time_point_pass.cpp : upgrade_lock__cons__time_point_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/cons/try_to_lock_pass.cpp : upgrade_lock__cons__try_to_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/lock_pass.cpp : upgrade_lock__locking__lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/try_lock_for_pass.cpp : upgrade_lock__locking__try_lock_for_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/try_lock_pass.cpp : upgrade_lock__locking__try_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/try_lock_until_pass.cpp : upgrade_lock__locking__try_lock_until_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/locking/unlock_pass.cpp : upgrade_lock__locking__unlock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/mod/member_swap_pass.cpp : upgrade_lock__mod__member_swap_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/mod/non_member_swap_pass.cpp : upgrade_lock__mod__non_member_swap_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/mod/release_pass.cpp : upgrade_lock__mod__release_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/obs/mutex_pass.cpp : upgrade_lock__obs__mutex_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/obs/op_bool_pass.cpp : upgrade_lock__obs__op_bool_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/obs/owns_lock_pass.cpp : upgrade_lock__obs__owns_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/locks/upgrade_lock/types_pass.cpp : upgrade_lock__types_p ]
+
+ [ thread-compile-fail-V2 ./sync/mutual_exclusion/mutex/assign_fail.cpp : : mutex__assign_f ]
+ [ thread-compile-fail-V2 ./sync/mutual_exclusion/mutex/copy_fail.cpp : : mutex__copy_f ]
+ [ thread-run2 ./sync/mutual_exclusion/mutex/default_pass.cpp : mutex__default_p ]
+ [ thread-run2 ./sync/mutual_exclusion/mutex/lock_pass.cpp : mutex__lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/mutex/native_handle_pass.cpp : mutex__native_handle_p ]
+ [ thread-run2 ./sync/mutual_exclusion/mutex/try_lock_pass.cpp : mutex__try_lock_p ]
+
+ [ thread-compile-fail-V2 ./sync/mutual_exclusion/recursive_mutex/assign_fail.cpp : : recursive_mutex__assign_f ]
+ [ thread-compile-fail-V2 ./sync/mutual_exclusion/recursive_mutex/copy_fail.cpp : : recursive_mutex__copy_f ]
+ [ thread-run2 ./sync/mutual_exclusion/recursive_mutex/default_pass.cpp : recursive_mutex__default_p ]
+ [ thread-run2 ./sync/mutual_exclusion/recursive_mutex/lock_pass.cpp : recursive_mutex__lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/recursive_mutex/native_handle_pass.cpp : recursive_mutex__native_handle_p ]
+ [ thread-run2 ./sync/mutual_exclusion/recursive_mutex/try_lock_pass.cpp : recursive_mutex__try_lock_p ]
+
+ [ thread-compile-fail-V2 ./sync/mutual_exclusion/recursive_timed_mutex/assign_fail.cpp : : recursive_timed_mutex__assign_f ]
+ [ thread-compile-fail-V2 ./sync/mutual_exclusion/recursive_timed_mutex/copy_fail.cpp : : recursive_timed_mutex__copy_f ]
+ [ thread-run2 ./sync/mutual_exclusion/recursive_timed_mutex/default_pass.cpp : recursive_timed_mutex__default_p ]
+ [ thread-run2 ./sync/mutual_exclusion/recursive_timed_mutex/lock_pass.cpp : recursive_timed_mutex__lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/recursive_timed_mutex/native_handle_pass.cpp : recursive_timed_mutex__native_handle_p ]
+ [ thread-run2 ./sync/mutual_exclusion/recursive_timed_mutex/try_lock_for_pass.cpp : recursive_timed_mutex__try_lock_for_p ]
+ [ thread-run2 ./sync/mutual_exclusion/recursive_timed_mutex/try_lock_pass.cpp : recursive_timed_mutex__try_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/recursive_timed_mutex/try_lock_until_pass.cpp : recursive_timed_mutex__try_lock_until_p ]
+
+ [ thread-compile-fail-V2 ./sync/mutual_exclusion/timed_mutex/assign_fail.cpp : : timed_mutex__assign_f ]
+ [ thread-compile-fail-V2 ./sync/mutual_exclusion/timed_mutex/copy_fail.cpp : : timed_mutex__copy_f ]
+ [ thread-run2 ./sync/mutual_exclusion/timed_mutex/default_pass.cpp : timed_mutex__default_p ]
+ [ thread-run2 ./sync/mutual_exclusion/timed_mutex/lock_pass.cpp : timed_mutex__lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/timed_mutex/native_handle_pass.cpp : timed_mutex__native_handle_p ]
+ [ thread-run2 ./sync/mutual_exclusion/timed_mutex/try_lock_for_pass.cpp : timed_mutex__try_lock_for_p ]
+ [ thread-run2 ./sync/mutual_exclusion/timed_mutex/try_lock_pass.cpp : timed_mutex__try_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/timed_mutex/try_lock_until_pass.cpp : timed_mutex__try_lock_until_p ]
+
+ [ thread-compile-fail-V2 ./sync/mutual_exclusion/shared_mutex/assign_fail.cpp : : shared_mutex__assign_f ]
+ [ thread-compile-fail-V2 ./sync/mutual_exclusion/shared_mutex/copy_fail.cpp : : shared_mutex__copy_f ]
+ [ thread-run2 ./sync/mutual_exclusion/shared_mutex/default_pass.cpp : shared_mutex__default_p ]
+ [ thread-run2 ./sync/mutual_exclusion/shared_mutex/lock_pass.cpp : shared_mutex__lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/shared_mutex/try_lock_for_pass.cpp : shared_mutex__try_lock_for_p ]
+ [ thread-run2 ./sync/mutual_exclusion/shared_mutex/try_lock_pass.cpp : shared_mutex__try_lock_p ]
+ [ thread-run2 ./sync/mutual_exclusion/shared_mutex/try_lock_until_pass.cpp : shared_mutex__try_lock_until_p ]
;
#explicit this_thread ;
test-suite this_thread
:
- [ thread-run2 ./threads/this_thread/get_id/get_id_pass.cpp : this_thread__get_id__get_id_pass ]
- [ thread-run2 ./threads/this_thread/sleep_for/sleep_for_pass.cpp : this_thread__sleep_for__sleep_for_pass ]
- [ thread-run2 ./threads/this_thread/sleep_until/sleep_until_pass.cpp : this_thread__sleep_until__sleep_until_pass ]
+ [ thread-run2 ./threads/this_thread/get_id/get_id_pass.cpp : this_thread__get_id_p ]
+ [ thread-run2 ./threads/this_thread/sleep_for/sleep_for_pass.cpp : this_thread__sleep_for_p ]
+ [ thread-run2 ./threads/this_thread/sleep_until/sleep_until_pass.cpp : this_thread__sleep_until_p ]
;
#explicit thread ;
test-suite thread
:
- [ thread-compile-fail-V2 ./threads/thread/assign/copy_fail.cpp : : thread__assign__copy_fail ]
- [ thread-run2 ./threads/thread/assign/move_pass.cpp : thread__assign__move_pass ]
- [ thread-compile-fail-V2 ./threads/thread/constr/copy_fail.cpp : : thread__constr__copy_fail ]
- [ thread-run2 ./threads/thread/constr/default_pass.cpp : thread__constr__default_pass ]
- [ thread-run2 ./threads/thread/constr/F_pass.cpp : thread__constr__F_pass ]
- [ thread-run2 ./threads/thread/constr/Frvalue_pass.cpp : thread__constr__Frvalue_pass ]
- #[ thread-run2 ./threads/thread/constr/FrvalueArgs_pass.cpp : thread__constr__FrvalueArgs_pass ]
- [ thread-run2 ./threads/thread/constr/move_pass.cpp : thread__constr__move_pass ]
- [ thread-run2 ./threads/thread/destr/dtor_pass.cpp : thread__destr__dtor_pass ]
- [ thread-run2 ./threads/thread/id/hash_pass.cpp : thread__id__hash_pass ]
- [ thread-run2 ./threads/thread/members/detach_pass.cpp : thread__members__detach_pass ]
- [ thread-run2 ./threads/thread/members/get_id_pass.cpp : thread__members__get_id_pass ]
- [ thread-run2 ./threads/thread/members/join_pass.cpp : thread__members__join_pass ]
- [ thread-run2 ./threads/thread/members/joinable_pass.cpp : thread__members__joinable_pass ]
- [ thread-run2 ./threads/thread/members/native_handle_pass.cpp : thread__members__native_handle_pass ]
- [ thread-run2 ./threads/thread/members/swap_pass.cpp : thread__members__swap_pass ]
- [ thread-run2 ./threads/thread/non_members/swap_pass.cpp : thread__non_members__swap_pass ]
- [ thread-run2 ./threads/thread/static/hardware_concurrency_pass.cpp : thread__static__hardware_concurrency_pass ]
- ;
-
- #explicit ttt ;
- #test-suite ttt
- #:
- #;
+ [ thread-compile-fail-V2 ./threads/thread/assign/copy_fail.cpp : : thread__assign__copy_f ]
+ [ thread-run2 ./threads/thread/assign/move_pass.cpp : thread__assign__move_p ]
+ [ thread-compile-fail-V2 ./threads/thread/constr/copy_fail.cpp : : thread__constr__copy_f ]
+ [ thread-run2 ./threads/thread/constr/default_pass.cpp : thread__constr__default_p ]
+ [ thread-run2 ./threads/thread/constr/F_pass.cpp : thread__constr__F_p ]
+ [ thread-run2 ./threads/thread/constr/Frvalue_pass.cpp : thread__constr__Frvalue_p ]
+ #[ thread-run2 ./threads/thread/constr/FrvalueArgs_pass.cpp : thread__constr__FrvalueArgs_p ]
+ [ thread-run2 ./threads/thread/constr/move_pass.cpp : thread__constr__move_p ]
+ [ thread-run2 ./threads/thread/destr/dtor_pass.cpp : thread__destr__dtor_p ]
+ [ thread-run2 ./threads/thread/id/hash_pass.cpp : thread__id__hash_p ]
+ [ thread-run2 ./threads/thread/members/detach_pass.cpp : thread__members__detach_p ]
+ [ thread-run2 ./threads/thread/members/get_id_pass.cpp : thread__members__get_id_p ]
+ [ thread-run2 ./threads/thread/members/join_pass.cpp : thread__members__join_p ]
+ [ thread-run2 ./threads/thread/members/joinable_pass.cpp : thread__members__joinable_p ]
+ [ thread-run2 ./threads/thread/members/native_handle_pass.cpp : thread__members__native_handle_p ]
+ [ thread-run2 ./threads/thread/members/swap_pass.cpp : thread__members__swap_p ]
+ [ thread-run2 ./threads/thread/non_members/swap_pass.cpp : thread__non_members__swap_p ]
+ [ thread-run2 ./threads/thread/static/hardware_concurrency_pass.cpp : thread__static__hardware_concurrency_p ]
+ ;
+
+ #explicit examples ;
+ test-suite examples
+ :
+ [ thread-run ../example/monitor.cpp ]
+ #[ thread-run ../example/starvephil.cpp ]
+ #[ thread-run ../example/tennis.cpp ]
+ #[ thread-run ../example/condition.cpp ]
+ [ thread-run ../example/mutex.cpp ]
+ [ thread-run ../example/once.cpp ]
+ [ thread-run ../example/recursive_mutex.cpp ]
+ [ thread-run2 ../example/thread.cpp : ex_thread ]
+ [ thread-run ../example/thread_group.cpp ]
+ [ thread-run ../example/tss.cpp ]
+ [ thread-run ../example/xtime.cpp ]
+ [ thread-run ../example/shared_monitor.cpp ]
+ [ thread-run ../example/shared_mutex.cpp ]
+ #[ thread-run ../example/v2_shared_monitor.cpp ]
+ #[ thread-run ../example/v2_shared_mutex.cpp ]
+ ;
+ explicit ttt ;
+ test-suite ttt
+ :
+ #[ thread-run2 ./sync/mutual_exclusion/locks/unique_lock/cons/move_ctor_upgrade_lock_pass.cpp : unique_lock__cons__move_ctor_upgrade_lock_p ]
+ ;
}
Added: trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/adopt_lock_pass.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/adopt_lock_pass.cpp 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -0,0 +1,57 @@
+//===----------------------------------------------------------------------===//
+//
+// 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) 2012 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/locks.hpp>
+
+// template <class Mutex> class lock_guard;
+
+// lock_guard(mutex_type& m, adopt_lock_t);
+
+#include <boost/thread/locks.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+typedef boost::chrono::high_resolution_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef boost::chrono::milliseconds ms;
+typedef boost::chrono::nanoseconds ns;
+
+boost::mutex m;
+
+void f()
+{
+ time_point t0 = Clock::now();
+ time_point t1;
+ {
+ m.lock();
+ boost::lock_guard<boost::mutex> lg(m, boost::adopt_lock);
+ t1 = Clock::now();
+ }
+ ns d = t1 - t0 - ms(250);
+ BOOST_TEST(d < ns(2500000)+ms(1000)); // within 2.5ms
+}
+
+int main()
+{
+ m.lock();
+ boost::thread t(f);
+ boost::this_thread::sleep_for(ms(250));
+ m.unlock();
+ t.join();
+
+ return boost::report_errors();
+}
+
Added: trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/copy_assign_fail.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/copy_assign_fail.cpp 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/locks.hpp>
+
+// template <class Mutex> class lock_guard;
+
+// lock_guard& operator=(lock_guard const&) = delete;
+
+#include <boost/thread/locks.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+boost::mutex m0;
+boost::mutex m1;
+
+int main()
+{
+ boost::lock_guard<boost::mutex> lk0(m0);
+ boost::lock_guard<boost::mutex> lk1(m1);
+ lk1 = lk0;
+
+}
+
Added: trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/copy_ctor_fail.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/copy_ctor_fail.cpp 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/locks.hpp>
+
+// template <class Mutex> class lock_guard;
+
+// lock_guard(lock_guard const&) = delete;
+
+
+#include <boost/thread/locks.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+boost::mutex m0;
+boost::mutex m1;
+
+int main()
+{
+ boost::lock_guard<boost::mutex> lk0(m0);
+ boost::lock_guard<boost::mutex> lk1 = lk0;
+}
+
Added: trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/default_pass.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/default_pass.cpp 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -0,0 +1,56 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/locks.hpp>
+
+// template <class Mutex> class lock_guard;
+
+// lock_guard(lock_guard const&) = delete;
+
+#include <boost/thread/locks.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+typedef boost::chrono::high_resolution_clock Clock;
+typedef Clock::time_point time_point;
+typedef Clock::duration duration;
+typedef boost::chrono::milliseconds ms;
+typedef boost::chrono::nanoseconds ns;
+
+boost::mutex m;
+
+void f()
+{
+ time_point t0 = Clock::now();
+ time_point t1;
+ {
+ boost::lock_guard<boost::mutex> lg(m);
+ t1 = Clock::now();
+ }
+ 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
+}
+
+int main()
+{
+ m.lock();
+ boost::thread t(f);
+ boost::this_thread::sleep_for(ms(250));
+ m.unlock();
+ t.join();
+
+ return boost::report_errors();
+}
Added: trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/types_pass.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/lock_guard/types_pass.cpp 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// 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) 2012 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/mutex.hpp>
+
+// <mutex>
+
+// template <class Mutex>
+// class lock_guard
+// {
+// public:
+// typedef Mutex mutex_type;
+// ...
+// };
+
+
+#include <boost/thread/mutex.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int main()
+{
+ BOOST_STATIC_ASSERT_MSG((boost::is_same<boost::lock_guard<boost::mutex>::mutex_type,
+ boost::mutex>::value), "");
+
+ return boost::report_errors();
+}
+
Modified: trunk/libs/thread/test/sync/mutual_exclusion/locks/shared_lock/cons/duration_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/locks/shared_lock/cons/duration_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/shared_lock/cons/duration_pass.cpp 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -40,7 +40,8 @@
BOOST_TEST(lk.owns_lock() == true);
time_point t1 = Clock::now();
ns d = t1 - t0 - ms(250);
- BOOST_TEST(d < ns(5000000)); // within 5ms
+ // This test is spurious as it depends on the time the thread system switches the threads
+ BOOST_TEST(d < ns(5000000)+ms(1000)); // within 5ms
}
void f2()
Modified: trunk/libs/thread/test/sync/mutual_exclusion/locks/shared_lock/cons/move_assign_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/locks/shared_lock/cons/move_assign_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/shared_lock/cons/move_assign_pass.cpp 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -47,7 +47,7 @@
{
boost::unique_lock<boost::shared_mutex> lk0(m0);
boost::shared_lock<boost::shared_mutex> lk1(m1);
- lk1 = boost::move(lk0);
+ lk1 = boost::shared_lock<boost::shared_mutex>(boost::move(lk0));
BOOST_TEST(lk1.mutex() == &m0);
BOOST_TEST(lk1.owns_lock() == true);
BOOST_TEST(lk0.mutex() == 0);
@@ -56,14 +56,14 @@
{
boost::shared_lock<boost::shared_mutex> lk1;
- lk1 = boost::unique_lock<boost::shared_mutex>(m0);
+ lk1 = boost::shared_lock<boost::shared_mutex>(boost::unique_lock<boost::shared_mutex>(m0));
BOOST_TEST(lk1.mutex() == &m0);
BOOST_TEST(lk1.owns_lock() == true);
}
{
boost::upgrade_lock<boost::shared_mutex> lk0(m0);
boost::shared_lock<boost::shared_mutex> lk1(m1);
- lk1 = boost::move(lk0);
+ lk1 = boost::shared_lock<boost::shared_mutex>(boost::move(lk0));
BOOST_TEST(lk1.mutex() == &m0);
BOOST_TEST(lk1.owns_lock() == true);
BOOST_TEST(lk0.mutex() == 0);
@@ -72,7 +72,7 @@
{
boost::shared_lock<boost::shared_mutex> lk1;
- lk1 = boost::upgrade_lock<boost::shared_mutex>(m0);
+ lk1 = boost::shared_lock<boost::shared_mutex>(boost::upgrade_lock<boost::shared_mutex>(m0));
BOOST_TEST(lk1.mutex() == &m0);
BOOST_TEST(lk1.owns_lock() == true);
}
Added: trunk/libs/thread/test/sync/mutual_exclusion/locks/shared_lock/types_pass.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/shared_lock/types_pass.cpp 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/mutex.hpp>
+
+// <mutex>
+
+// template <class Mutex>
+// class shared_lock
+// {
+// public:
+// typedef Mutex mutex_type;
+// ...
+// };
+
+
+#include <boost/thread/shared_mutex.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int main()
+{
+ BOOST_STATIC_ASSERT_MSG((boost::is_same<boost::shared_lock<boost::shared_mutex>::mutex_type,
+ boost::shared_mutex>::value), "");
+
+ return boost::report_errors();
+}
+
Modified: trunk/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/types_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/types_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/unique_lock/types_pass.cpp 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -16,26 +16,23 @@
// <mutex>
-// 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{};
+// template <class Mutex>
+// class unique_lock
+// {
+// public:
+// typedef Mutex mutex_type;
+// ...
+// };
+
#include <boost/thread/mutex.hpp>
+#include <boost/static_assert.hpp>
#include <boost/detail/lightweight_test.hpp>
int main()
{
- typedef boost::defer_lock_t T1;
- typedef boost::try_to_lock_t T2;
- typedef boost::adopt_lock_t T3;
-
- T1 t1 = boost::defer_lock;
- T2 t2 = boost::try_to_lock;
- T3 t3 = boost::adopt_lock;
+ BOOST_STATIC_ASSERT_MSG((boost::is_same<boost::unique_lock<boost::mutex>::mutex_type,
+ boost::mutex>::value), "");
return boost::report_errors();
}
Modified: trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/cons/duration_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/cons/duration_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/cons/duration_pass.cpp 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -40,7 +40,8 @@
BOOST_TEST(lk.owns_lock() == true);
time_point t1 = Clock::now();
ns d = t1 - t0 - ms(250);
- BOOST_TEST(d < ns(5000000)); // within 5ms
+ // This test is spurious as it depends on the time the thread system switches the threads
+ BOOST_TEST(d < ns(5000000)+ms(1000)); // within 5ms
}
void f2()
Modified: trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/cons/move_assign_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/cons/move_assign_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/cons/move_assign_pass.cpp 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -47,7 +47,7 @@
{
boost::unique_lock<boost::shared_mutex> lk0(m0);
boost::upgrade_lock<boost::shared_mutex> lk1(m1);
- lk1 = boost::move(lk0);
+ lk1 = boost::upgrade_lock<boost::shared_mutex>(boost::move(lk0));
BOOST_TEST(lk1.mutex() == &m0);
BOOST_TEST(lk1.owns_lock() == true);
BOOST_TEST(lk0.mutex() == 0);
@@ -56,7 +56,7 @@
{
boost::upgrade_lock<boost::shared_mutex> lk1;
- lk1 = boost::unique_lock<boost::shared_mutex>(m0);
+ lk1 = boost::upgrade_lock<boost::shared_mutex>(boost::unique_lock<boost::shared_mutex>(m0));
BOOST_TEST(lk1.mutex() == &m0);
BOOST_TEST(lk1.owns_lock() == true);
}
Modified: trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/cons/time_point_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/cons/time_point_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/cons/time_point_pass.cpp 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -14,10 +14,10 @@
// <boost/thread/locks.hpp>
-// template <class Mutex> class shared_lock;
+// template <class Mutex> class upgrade_lock;
// template <class Clock, class Duration>
-// shared_lock(mutex_type& m, const chrono::time_point<Clock, Duration>& abs_time);
+// upgrade_lock(mutex_type& m, const chrono::time_point<Clock, Duration>& abs_time);
#include <boost/thread/locks.hpp>
#include <boost/thread/shared_mutex.hpp>
@@ -35,7 +35,7 @@
void f1()
{
time_point t0 = Clock::now();
- boost::shared_lock<boost::shared_mutex> lk(m, Clock::now() + ms(300));
+ boost::upgrade_lock<boost::shared_mutex> lk(m, Clock::now() + ms(300));
BOOST_TEST(lk.owns_lock() == true);
time_point t1 = Clock::now();
ns d = t1 - t0 - ms(250);
@@ -45,7 +45,7 @@
void f2()
{
time_point t0 = Clock::now();
- boost::shared_lock<boost::shared_mutex> lk(m, Clock::now() + ms(250));
+ boost::upgrade_lock<boost::shared_mutex> lk(m, Clock::now() + ms(250));
BOOST_TEST(lk.owns_lock() == false);
time_point t1 = Clock::now();
ns d = t1 - t0 - ms(250);
Modified: trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/cons/try_to_lock_pass.cpp
==============================================================================
--- trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/cons/try_to_lock_pass.cpp (original)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/cons/try_to_lock_pass.cpp 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -14,9 +14,9 @@
// <boost/thread/locks.hpp>
-// template <class Mutex> class shared_lock;
+// template <class Mutex> class upgrade_lock;
-// shared_lock(mutex_type& m, try_to_lock_t);
+// upgrade_lock(mutex_type& m, try_to_lock_t);
#include <boost/thread/locks.hpp>
@@ -36,20 +36,20 @@
{
time_point t0 = Clock::now();
{
- boost::shared_lock<boost::shared_mutex> lk(m, boost::try_to_lock);
+ boost::upgrade_lock<boost::shared_mutex> lk(m, boost::try_to_lock);
BOOST_TEST(lk.owns_lock() == false);
}
{
- boost::shared_lock<boost::shared_mutex> lk(m, boost::try_to_lock);
+ boost::upgrade_lock<boost::shared_mutex> lk(m, boost::try_to_lock);
BOOST_TEST(lk.owns_lock() == false);
}
{
- boost::shared_lock<boost::shared_mutex> lk(m, boost::try_to_lock);
+ boost::upgrade_lock<boost::shared_mutex> lk(m, boost::try_to_lock);
BOOST_TEST(lk.owns_lock() == false);
}
while (true)
{
- boost::shared_lock<boost::shared_mutex> lk(m, boost::try_to_lock);
+ boost::upgrade_lock<boost::shared_mutex> lk(m, boost::try_to_lock);
if (lk.owns_lock()) break;
}
time_point t1 = Clock::now();
Added: trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/types_pass.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/thread/test/sync/mutual_exclusion/locks/upgrade_lock/types_pass.cpp 2012-03-18 14:21:45 EDT (Sun, 18 Mar 2012)
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/mutex.hpp>
+
+// <mutex>
+
+// template <class Mutex>
+// class upgrade_lock
+// {
+// public:
+// typedef Mutex mutex_type;
+// ...
+// };
+
+
+#include <boost/thread/shared_mutex.hpp>
+#include <boost/static_assert.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int main()
+{
+ BOOST_STATIC_ASSERT_MSG((boost::is_same<boost::upgrade_lock<boost::upgrade_mutex>::mutex_type,
+ boost::upgrade_mutex>::value), "");
+
+ 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