summaryrefslogtreecommitdiff
path: root/libs/thread/test/threads/thread
diff options
context:
space:
mode:
Diffstat (limited to 'libs/thread/test/threads/thread')
-rw-r--r--libs/thread/test/threads/thread/assign/copy_fail.cpp80
-rw-r--r--libs/thread/test/threads/thread/assign/move_pass.cpp102
-rw-r--r--libs/thread/test/threads/thread/constr/FArgs_pass.cpp143
-rw-r--r--libs/thread/test/threads/thread/constr/F_pass.cpp148
-rw-r--r--libs/thread/test/threads/thread/constr/FrvalueArgs_pass.cpp47
-rw-r--r--libs/thread/test/threads/thread/constr/Frvalue_pass.cpp54
-rw-r--r--libs/thread/test/threads/thread/constr/copy_fail.cpp95
-rw-r--r--libs/thread/test/threads/thread/constr/default_pass.cpp30
-rw-r--r--libs/thread/test/threads/thread/constr/move_pass.cpp94
-rw-r--r--libs/thread/test/threads/thread/destr/dtor_pass.cpp81
-rw-r--r--libs/thread/test/threads/thread/id/hash_pass.cpp40
-rw-r--r--libs/thread/test/threads/thread/members/detach_pass.cpp75
-rw-r--r--libs/thread/test/threads/thread/members/get_id_pass.cpp73
-rw-r--r--libs/thread/test/threads/thread/members/join_pass.cpp151
-rw-r--r--libs/thread/test/threads/thread/members/joinable_pass.cpp71
-rw-r--r--libs/thread/test/threads/thread/members/native_handle_pass.cpp71
-rw-r--r--libs/thread/test/threads/thread/members/swap_pass.cpp73
-rw-r--r--libs/thread/test/threads/thread/non_members/swap_pass.cpp72
-rw-r--r--libs/thread/test/threads/thread/static/hardware_concurrency_pass.cpp28
19 files changed, 1528 insertions, 0 deletions
diff --git a/libs/thread/test/threads/thread/assign/copy_fail.cpp b/libs/thread/test/threads/thread/assign/copy_fail.cpp
new file mode 100644
index 0000000000..23a15b7cc2
--- /dev/null
+++ b/libs/thread/test/threads/thread/assign/copy_fail.cpp
@@ -0,0 +1,80 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// thread& operator=(thread&& t);
+
+#include <boost/thread/thread.hpp>
+#include <new>
+#include <cstdlib>
+#include <boost/detail/lightweight_test.hpp>
+
+class G
+{
+ int alive_;
+public:
+ static int n_alive;
+ static bool op_run;
+
+ G() :
+ alive_(1)
+ {
+ ++n_alive;
+ }
+ G(const G& g) :
+ alive_(g.alive_)
+ {
+ ++n_alive;
+ }
+ ~G()
+ {
+ alive_ = 0;
+ --n_alive;
+ }
+
+ void operator()()
+ {
+ BOOST_TEST(alive_ == 1);
+ BOOST_TEST(n_alive == 1);
+ op_run = true;
+ }
+
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+ {
+ boost::thread t0( (G()));
+ boost::thread t1;
+ t1 = t0;
+ }
+}
+
+void remove_unused_warning()
+{
+ //../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
+ //../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
+ //../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
+
+ (void)boost::system::posix_category;
+ (void)boost::system::errno_ecat;
+ (void)boost::system::native_ecat;
+
+}
diff --git a/libs/thread/test/threads/thread/assign/move_pass.cpp b/libs/thread/test/threads/thread/assign/move_pass.cpp
new file mode 100644
index 0000000000..2163c54397
--- /dev/null
+++ b/libs/thread/test/threads/thread/assign/move_pass.cpp
@@ -0,0 +1,102 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// thread& operator=(thread&& t);
+
+#define BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE
+
+#include <boost/thread/thread.hpp>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+#include <boost/detail/lightweight_test.hpp>
+
+class G
+{
+ int alive_;
+public:
+ static int n_alive;
+ static bool op_run;
+
+ G() :
+ alive_(1)
+ {
+ ++n_alive;
+ }
+ G(const G& g) :
+ alive_(g.alive_)
+ {
+ ++n_alive;
+ }
+ ~G()
+ {
+ alive_ = 0;
+ --n_alive;
+ }
+
+ void operator()()
+ {
+ BOOST_TEST(alive_ == 1);
+ BOOST_TEST(n_alive == 1);
+ op_run = true;
+ }
+
+ void operator()(int i, double j)
+ {
+ BOOST_TEST(alive_ == 1);
+ //BOOST_TEST(n_alive == 1);
+ BOOST_TEST(i == 5);
+ BOOST_TEST(j == 5.5);
+ op_run = true;
+ }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+void f1()
+{
+ std::exit(boost::report_errors());
+}
+
+int main()
+{
+ std::set_terminate(f1);
+ {
+ BOOST_TEST(G::n_alive == 0);
+ BOOST_TEST(!G::op_run);
+ boost::thread t0(G(), 5, 5.5);
+ boost::thread::id id = t0.get_id();
+ boost::thread t1;
+ t1 = boost::move(t0);
+ BOOST_TEST(t1.get_id() == id);
+ BOOST_TEST(t0.get_id() == boost::thread::id());
+ t1.join();
+ BOOST_TEST(G::op_run);
+ }
+// BOOST_TEST(G::n_alive == 0);
+// {
+// boost::thread t0(G(), 5, 5.5);
+// boost::thread::id id = t0.get_id();
+// boost::thread t1;
+// t0 = boost::move(t1);
+// BOOST_TEST(false);
+// }
+ return boost::report_errors();
+}
+
diff --git a/libs/thread/test/threads/thread/constr/FArgs_pass.cpp b/libs/thread/test/threads/thread/constr/FArgs_pass.cpp
new file mode 100644
index 0000000000..6a573fe3ea
--- /dev/null
+++ b/libs/thread/test/threads/thread/constr/FArgs_pass.cpp
@@ -0,0 +1,143 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// template <class F, class ...Args> thread(F f, Args... args);
+
+#include <new>
+#include <cstdlib>
+#include <cassert>
+#include <boost/thread/thread.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+unsigned throw_one = 0xFFFF;
+
+#if defined _GLIBCXX_THROW
+void* operator new(std::size_t s) _GLIBCXX_THROW (std::bad_alloc)
+#elif defined BOOST_MSVC
+void* operator new(std::size_t s)
+#else
+void* operator new(std::size_t s) throw (std::bad_alloc)
+#endif
+{
+ std::cout << __FILE__ << ":" << __LINE__ << std::endl;
+ if (throw_one == 0) throw std::bad_alloc();
+ --throw_one;
+ return std::malloc(s);
+}
+
+#if defined BOOST_MSVC
+void operator delete(void* p)
+#else
+void operator delete(void* p) throw ()
+#endif
+{
+ std::cout << __FILE__ << ":" << __LINE__ << std::endl;
+ std::free(p);
+}
+
+bool f_run = false;
+
+void f(int i, double j)
+{
+ BOOST_TEST(i == 5);
+ BOOST_TEST(j == 5.5);
+ f_run = true;
+}
+
+class G
+{
+ int alive_;
+public:
+ static int n_alive;
+ static bool op_run;
+
+ G() :
+ alive_(1)
+ {
+ ++n_alive;
+ }
+ G(const G& g) :
+ alive_(g.alive_)
+ {
+ ++n_alive;
+ }
+ ~G()
+ {
+ alive_ = 0;
+ --n_alive;
+ }
+
+ void operator()(int i, double j)
+ {
+ BOOST_TEST(alive_ == 1);
+ BOOST_TEST(n_alive >= 1);
+ BOOST_TEST(i == 5);
+ BOOST_TEST(j == 5.5);
+ op_run = true;
+ }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+
+int main()
+{
+ {
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << G::n_alive << std::endl;
+ boost::thread t(f, 5, 5.5);
+ t.join();
+ BOOST_TEST(f_run == true);
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << G::n_alive << std::endl;
+ }
+#ifndef BOOST_MSVC
+ f_run = false;
+ {
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << G::n_alive << std::endl;
+ try
+ {
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << G::n_alive << std::endl;
+ throw_one = 0;
+ boost::thread t(f, 5, 5.5);
+ BOOST_TEST(false);
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << G::n_alive << std::endl;
+ }
+ catch (...)
+ {
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << G::n_alive << std::endl;
+ throw_one = 0xFFFF;
+ BOOST_TEST(!f_run);
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << G::n_alive << std::endl;
+ }
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << G::n_alive << std::endl;
+ }
+#endif
+ {
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << G::n_alive << std::endl;
+ BOOST_TEST(G::n_alive == 0);
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << G::n_alive << std::endl;
+ BOOST_TEST(!G::op_run);
+ boost::thread t(G(), 5, 5.5);
+ t.join();
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << G::n_alive << std::endl;
+ BOOST_TEST(G::n_alive == 0);
+ BOOST_TEST(G::op_run);
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << G::n_alive << std::endl;
+ }
+
+ return boost::report_errors();
+}
diff --git a/libs/thread/test/threads/thread/constr/F_pass.cpp b/libs/thread/test/threads/thread/constr/F_pass.cpp
new file mode 100644
index 0000000000..03208a0d62
--- /dev/null
+++ b/libs/thread/test/threads/thread/constr/F_pass.cpp
@@ -0,0 +1,148 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// template <class F, class ...Args> thread(F f, Args... args);
+
+#include <new>
+#include <cstdlib>
+#include <cassert>
+#include <boost/thread/thread.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+unsigned throw_one = 0xFFFF;
+
+#if defined _GLIBCXX_THROW
+void* operator new(std::size_t s) _GLIBCXX_THROW (std::bad_alloc)
+#elif defined BOOST_MSVC
+void* operator new(std::size_t s)
+#else
+void* operator new(std::size_t s) throw (std::bad_alloc)
+#endif
+{
+ std::cout << __FILE__ << ":" << __LINE__ << std::endl;
+ if (throw_one == 0) throw std::bad_alloc();
+ --throw_one;
+ return std::malloc(s);
+}
+
+#if defined BOOST_MSVC
+void operator delete(void* p)
+#else
+void operator delete(void* p) throw ()
+#endif
+{
+ std::cout << __FILE__ << ":" << __LINE__ << std::endl;
+ std::free(p);
+}
+
+bool f_run = false;
+
+void f()
+{
+ f_run = true;
+}
+
+class G
+{
+ int alive_;
+public:
+ static int n_alive;
+ static bool op_run;
+
+ G() :
+ alive_(1)
+ {
+ ++n_alive;
+ }
+ G(const G& g) :
+ alive_(g.alive_)
+ {
+ ++n_alive;
+ }
+ ~G()
+ {
+ alive_ = 0;
+ --n_alive;
+ }
+
+ void operator()()
+ {
+ BOOST_TEST(alive_ == 1);
+ BOOST_TEST(n_alive >= 1);
+ op_run = true;
+ }
+
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+
+int main()
+{
+ {
+ boost::thread t(f);
+ t.join();
+ BOOST_TEST(f_run == true);
+ }
+ f_run = false;
+#ifndef BOOST_MSVC
+ {
+ try
+ {
+ throw_one = 0;
+ boost::thread t(f);
+ BOOST_TEST(false);
+ }
+ catch (...)
+ {
+ throw_one = 0xFFFF;
+ BOOST_TEST(!f_run);
+ }
+ }
+#endif
+ {
+ BOOST_TEST(G::n_alive == 0);
+ BOOST_TEST(!G::op_run);
+ boost::thread t( (G()));
+ t.join();
+ BOOST_TEST(G::n_alive == 0);
+ BOOST_TEST(G::op_run);
+ }
+#ifndef BOOST_MSVC
+ G::op_run = false;
+ {
+ try
+ {
+ throw_one = 0;
+ BOOST_TEST(G::n_alive == 0);
+ BOOST_TEST(!G::op_run);
+ boost::thread t( (G()));
+ BOOST_TEST(false);
+ }
+ catch (...)
+ {
+ throw_one = 0xFFFF;
+ BOOST_TEST(G::n_alive == 0);
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << G::n_alive << std::endl;
+ BOOST_TEST(!G::op_run);
+ }
+ }
+#endif
+
+ return boost::report_errors();
+}
diff --git a/libs/thread/test/threads/thread/constr/FrvalueArgs_pass.cpp b/libs/thread/test/threads/thread/constr/FrvalueArgs_pass.cpp
new file mode 100644
index 0000000000..fdd5be1c12
--- /dev/null
+++ b/libs/thread/test/threads/thread/constr/FrvalueArgs_pass.cpp
@@ -0,0 +1,47 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// template <class F, class ...Args> thread(F&& f, Args&&... args);
+
+#include <boost/thread/thread.hpp>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+#include <boost/detail/lightweight_test.hpp>
+
+class MoveOnly
+{
+ BOOST_THREAD_MOVABLE_ONLY(MoveOnly)
+ MoveOnly()
+ {
+ }
+ MoveOnly(BOOST_THREAD_RV_REF(MoveOnly))
+ {}
+
+ void operator()(BOOST_THREAD_RV_REF(MoveOnly))
+ {
+ }
+};
+
+int main()
+{
+ {
+ boost::thread t = boost::thread( BOOST_THREAD_MAKE_RV_REF(MoveOnly()), BOOST_THREAD_MAKE_RV_REF(MoveOnly()) );
+ t.join();
+ }
+ return boost::report_errors();
+}
diff --git a/libs/thread/test/threads/thread/constr/Frvalue_pass.cpp b/libs/thread/test/threads/thread/constr/Frvalue_pass.cpp
new file mode 100644
index 0000000000..4d89a76356
--- /dev/null
+++ b/libs/thread/test/threads/thread/constr/Frvalue_pass.cpp
@@ -0,0 +1,54 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// template <class F, class ...Args> thread(F&& f, Args&&... args);
+
+#define BOOST_THREAD_USES_MOVE
+
+#include <boost/thread/thread.hpp>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+#include <boost/detail/lightweight_test.hpp>
+
+class MoveOnly
+{
+public:
+ BOOST_THREAD_MOVABLE_ONLY(MoveOnly)
+ MoveOnly()
+ {
+ }
+ MoveOnly(BOOST_THREAD_RV_REF(MoveOnly))
+ {}
+
+ void operator()()
+ {
+ }
+};
+
+MoveOnly MakeMoveOnly() {
+ return BOOST_THREAD_MAKE_RV_REF(MoveOnly());
+}
+
+int main()
+{
+ {
+ boost::thread t(( BOOST_THREAD_MAKE_RV_REF(MakeMoveOnly()) ));
+ t.join();
+ }
+ return boost::report_errors();
+}
diff --git a/libs/thread/test/threads/thread/constr/copy_fail.cpp b/libs/thread/test/threads/thread/constr/copy_fail.cpp
new file mode 100644
index 0000000000..0b04b8c813
--- /dev/null
+++ b/libs/thread/test/threads/thread/constr/copy_fail.cpp
@@ -0,0 +1,95 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// thread(const thread&) = delete;
+
+#include <boost/thread/thread.hpp>
+#include <new>
+#include <cstdlib>
+#include <boost/detail/lightweight_test.hpp>
+
+class G
+{
+ int alive_;
+public:
+ static int n_alive;
+ static bool op_run;
+
+ G() :
+ alive_(1)
+ {
+ ++n_alive;
+ }
+ G(const G& g) :
+ alive_(g.alive_)
+ {
+ ++n_alive;
+ }
+ ~G()
+ {
+ alive_ = 0;
+ --n_alive;
+ }
+
+ void operator()()
+ {
+ BOOST_TEST(alive_ == 1);
+ BOOST_TEST(n_alive == 1);
+ op_run = true;
+ }
+
+ void operator()(int i, double j)
+ {
+ BOOST_TEST(alive_ == 1);
+ BOOST_TEST(n_alive == 1);
+ BOOST_TEST(i == 5);
+ BOOST_TEST(j == 5.5);
+ op_run = true;
+ }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+ {
+ BOOST_TEST(G::n_alive == 0);
+ BOOST_TEST(!G::op_run);
+ boost::thread t0(G(), 5, 5.5);
+ boost::thread::id id = t0.get_id();
+ boost::thread t1( (t0));
+ BOOST_TEST(t1.get_id() == id);
+ BOOST_TEST(t0.get_id() == boost::thread::id());
+ t1.join();
+ BOOST_TEST(G::n_alive == 0);
+ BOOST_TEST(G::op_run);
+ }
+}
+
+void remove_unused_warning()
+{
+ //../../../boost/system/error_code.hpp:214:36: warning: Ôboost::system::posix_categoryÕ defined but not used [-Wunused-variable]
+ //../../../boost/system/error_code.hpp:215:36: warning: Ôboost::system::errno_ecatÕ defined but not used [-Wunused-variable]
+ //../../../boost/system/error_code.hpp:216:36: warning: Ôboost::system::native_ecatÕ defined but not used [-Wunused-variable]
+
+ (void)boost::system::posix_category;
+ (void)boost::system::errno_ecat;
+ (void)boost::system::native_ecat;
+
+}
diff --git a/libs/thread/test/threads/thread/constr/default_pass.cpp b/libs/thread/test/threads/thread/constr/default_pass.cpp
new file mode 100644
index 0000000000..9270e89c04
--- /dev/null
+++ b/libs/thread/test/threads/thread/constr/default_pass.cpp
@@ -0,0 +1,30 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// thread();
+
+#include <boost/thread/thread.hpp>
+#include <cassert>
+#include <boost/detail/lightweight_test.hpp>
+
+int main()
+{
+ boost::thread t;
+ BOOST_TEST(t.get_id() == boost::thread::id());
+ return boost::report_errors();
+}
diff --git a/libs/thread/test/threads/thread/constr/move_pass.cpp b/libs/thread/test/threads/thread/constr/move_pass.cpp
new file mode 100644
index 0000000000..b97b49656d
--- /dev/null
+++ b/libs/thread/test/threads/thread/constr/move_pass.cpp
@@ -0,0 +1,94 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// thread(thread&& t);
+
+#include <boost/thread/thread.hpp>
+#include <new>
+#include <cstdlib>
+#include <boost/detail/lightweight_test.hpp>
+
+class G
+{
+ int alive_;
+public:
+ static int n_alive;
+ static bool op_run;
+
+ G() :
+ alive_(1)
+ {
+ ++n_alive;
+ }
+ G(const G& g) :
+ alive_(g.alive_)
+ {
+ ++n_alive;
+ }
+ ~G()
+ {
+ alive_ = 0;
+ --n_alive;
+ }
+
+ void operator()()
+ {
+ BOOST_TEST(alive_ == 1);
+ BOOST_TEST(n_alive == 1);
+ op_run = true;
+ }
+
+ void operator()(int i, double j)
+ {
+ BOOST_TEST(alive_ == 1);
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << n_alive << std::endl;
+ BOOST_TEST(n_alive == 1);
+ BOOST_TEST(i == 5);
+ BOOST_TEST(j == 5.5);
+ op_run = true;
+ }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+boost::thread make_thread() {
+ return boost::thread(G(), 5, 5.5);
+}
+
+int main()
+{
+ {
+ BOOST_TEST(G::n_alive == 0);
+ BOOST_TEST(!G::op_run);
+ boost::thread t0((G()));
+ boost::thread::id id = t0.get_id();
+ boost::thread t1((boost::move(t0)));
+ BOOST_TEST(t1.get_id() == id);
+ BOOST_TEST(t0.get_id() == boost::thread::id());
+ t1.join();
+ BOOST_TEST(G::op_run);
+ }
+ BOOST_TEST(G::n_alive == 0);
+ {
+ boost::thread t1((BOOST_THREAD_MAKE_RV_REF(make_thread())));
+ t1.join();
+ BOOST_TEST(G::op_run);
+ }
+ BOOST_TEST(G::n_alive == 0);
+ return boost::report_errors();
+}
diff --git a/libs/thread/test/threads/thread/destr/dtor_pass.cpp b/libs/thread/test/threads/thread/destr/dtor_pass.cpp
new file mode 100644
index 0000000000..a5c62cf424
--- /dev/null
+++ b/libs/thread/test/threads/thread/destr/dtor_pass.cpp
@@ -0,0 +1,81 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// ~thread();
+
+#define BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE
+
+#include <boost/thread/thread.hpp>
+#include <new>
+#include <cstdlib>
+#include <boost/detail/lightweight_test.hpp>
+
+class G
+{
+ int alive_;
+public:
+ static int n_alive;
+ static bool op_run;
+
+ G() :
+ alive_(1)
+ {
+ ++n_alive;
+ }
+ G(const G& g) :
+ alive_(g.alive_)
+ {
+ ++n_alive;
+ }
+ ~G()
+ {
+ alive_ = 0;
+ --n_alive;
+ }
+
+ void operator()()
+ {
+ BOOST_TEST(alive_ == 1);
+ BOOST_TEST(n_alive == 1);
+ op_run = true;
+ }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+void f1()
+{
+ std::exit(boost::report_errors());
+}
+
+int main()
+{
+ std::set_terminate(f1);
+ {
+ BOOST_TEST(G::n_alive == 0);
+ BOOST_TEST(!G::op_run);
+ boost::thread t( (G()));
+#if defined BOOST_THREAD_USES_CHRONO
+ boost::this_thread::sleep_for(boost::chrono::milliseconds(250));
+#endif
+ BOOST_TEST(t.joinable());
+ }
+ BOOST_TEST(false);
+ return boost::report_errors();
+}
+
diff --git a/libs/thread/test/threads/thread/id/hash_pass.cpp b/libs/thread/test/threads/thread/id/hash_pass.cpp
new file mode 100644
index 0000000000..5202d46be8
--- /dev/null
+++ b/libs/thread/test/threads/thread/id/hash_pass.cpp
@@ -0,0 +1,40 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// <functional>
+
+// template <class T>
+// struct hash
+// : public unary_function<T, size_t>
+// {
+// size_t operator()(T val) const;
+// };
+
+
+#include <boost/thread/thread.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int main()
+{
+ {
+ boost::thread::id id1;
+ boost::thread::id id2 = boost::this_thread::get_id();
+ typedef boost::hash<boost::thread::id> H;
+ H h;
+ BOOST_TEST(h(id1) != h(id2));
+ }
+ return boost::report_errors();
+}
+
diff --git a/libs/thread/test/threads/thread/members/detach_pass.cpp b/libs/thread/test/threads/thread/members/detach_pass.cpp
new file mode 100644
index 0000000000..7170416d5b
--- /dev/null
+++ b/libs/thread/test/threads/thread/members/detach_pass.cpp
@@ -0,0 +1,75 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// void detach();
+
+#include <boost/thread/thread.hpp>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+#include <boost/detail/lightweight_test.hpp>
+
+class G
+{
+ int alive_;
+public:
+ static int n_alive;
+ static bool op_run;
+
+ G() :
+ alive_(1)
+ {
+ ++n_alive;
+ }
+ G(const G& g) :
+ alive_(g.alive_)
+ {
+ ++n_alive;
+ }
+ ~G()
+ {
+ alive_ = 0;
+ --n_alive;
+ }
+
+ void operator()()
+ {
+ BOOST_TEST(alive_ == 1);
+ BOOST_TEST(n_alive == 1);
+ op_run = true;
+ }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+ {
+ boost::thread t0( (G()));
+ BOOST_TEST(t0.joinable());
+ t0.detach();
+ BOOST_TEST(!t0.joinable());
+#if defined BOOST_THREAD_USES_CHRONO
+ boost::this_thread::sleep_for(boost::chrono::milliseconds(250));
+ BOOST_TEST(G::op_run);
+ BOOST_TEST(G::n_alive == 0);
+#endif
+ }
+ return boost::report_errors();
+}
+
diff --git a/libs/thread/test/threads/thread/members/get_id_pass.cpp b/libs/thread/test/threads/thread/members/get_id_pass.cpp
new file mode 100644
index 0000000000..02c0e34a12
--- /dev/null
+++ b/libs/thread/test/threads/thread/members/get_id_pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// id get_id() const;
+
+#include <boost/thread/thread.hpp>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+#include <boost/detail/lightweight_test.hpp>
+
+class G
+{
+ int alive_;
+public:
+ static int n_alive;
+ static bool op_run;
+
+ G() :
+ alive_(1)
+ {
+ ++n_alive;
+ }
+ G(const G& g) :
+ alive_(g.alive_)
+ {
+ ++n_alive;
+ }
+ ~G()
+ {
+ alive_ = 0;
+ --n_alive;
+ }
+
+ void operator()()
+ {
+ BOOST_TEST(alive_ == 1);
+ //BOOST_TEST(n_alive == 1);
+ op_run = true;
+ }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+ {
+ boost::thread t0( (G()));
+ //boost::thread::id id0 = t0.get_id();
+ boost::thread t1;
+ boost::thread::id id1 = t1.get_id();
+ BOOST_TEST(t0.get_id() != id1);
+ BOOST_TEST(t1.get_id() == boost::thread::id());
+ t0.join();
+ }
+ return boost::report_errors();
+}
+
diff --git a/libs/thread/test/threads/thread/members/join_pass.cpp b/libs/thread/test/threads/thread/members/join_pass.cpp
new file mode 100644
index 0000000000..72977be0de
--- /dev/null
+++ b/libs/thread/test/threads/thread/members/join_pass.cpp
@@ -0,0 +1,151 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// void join();
+
+#define BOOST_THREAD_VESRION 3
+#include <boost/thread/thread.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/locks.hpp>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+#include <iostream>
+#include <boost/detail/lightweight_test.hpp>
+
+class G
+{
+ int alive_;
+public:
+ static int n_alive;
+ static bool op_run;
+
+ G() :
+ alive_(1)
+ {
+ ++n_alive;
+ }
+ G(const G& g) :
+ alive_(g.alive_)
+ {
+ ++n_alive;
+ }
+ ~G()
+ {
+ alive_ = 0;
+ --n_alive;
+ }
+
+ void operator()()
+ {
+ BOOST_TEST(alive_ == 1);
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << n_alive << std::endl;
+ BOOST_TEST(n_alive == 1);
+ op_run = true;
+ }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+boost::thread* resource_deadlock_would_occur_th;
+boost::mutex resource_deadlock_would_occur_mtx;
+void resource_deadlock_would_occur_tester()
+{
+ try
+ {
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << std::endl;
+ boost::unique_lock<boost::mutex> lk(resource_deadlock_would_occur_mtx);
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << std::endl;
+
+ resource_deadlock_would_occur_th->join();
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << std::endl;
+ BOOST_TEST(false);
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << std::endl;
+ }
+ catch (boost::system::system_error& e)
+ {
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << std::endl;
+ BOOST_TEST(e.code().value() == boost::system::errc::resource_deadlock_would_occur);
+ }
+ catch (...)
+ {
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << std::endl;
+ BOOST_TEST(false&&"exception thrown");
+ }
+}
+
+int main()
+{
+ {
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << std::endl;
+ boost::thread t0( (G()));
+ BOOST_TEST(t0.joinable());
+ t0.join();
+ BOOST_TEST(!t0.joinable());
+ }
+ {
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << std::endl;
+ boost::unique_lock<boost::mutex> lk(resource_deadlock_would_occur_mtx);
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << std::endl;
+ boost::thread t0( resource_deadlock_would_occur_tester );
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << std::endl;
+ resource_deadlock_would_occur_th = &t0;
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << std::endl;
+ BOOST_TEST(t0.joinable());
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << std::endl;
+ lk.unlock();
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << std::endl;
+ t0.join();
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << std::endl;
+ BOOST_TEST(!t0.joinable());
+ std::cout << __FILE__ << ":" << __LINE__ <<" " << std::endl;
+ }
+
+// {
+// boost::thread t0( (G()));
+// t0.detach();
+// try
+// {
+// t0.join();
+// BOOST_TEST(false);
+// }
+// catch (boost::system::system_error& e)
+// {
+// BOOST_TEST(e.code().value() == boost::system::errc::no_such_process);
+// }
+// }
+// {
+// boost::thread t0( (G()));
+// BOOST_TEST(t0.joinable());
+// t0.join();
+// BOOST_TEST(!t0.joinable());
+// try
+// {
+// t0.join();
+// BOOST_TEST(false);
+// }
+// catch (boost::system::system_error& e)
+// {
+// BOOST_TEST(e.code().value() == boost::system::errc::invalid_argument);
+// }
+//
+// }
+
+ return boost::report_errors();
+}
+
diff --git a/libs/thread/test/threads/thread/members/joinable_pass.cpp b/libs/thread/test/threads/thread/members/joinable_pass.cpp
new file mode 100644
index 0000000000..60a6db76f6
--- /dev/null
+++ b/libs/thread/test/threads/thread/members/joinable_pass.cpp
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// bool joinable() const;
+
+#include <boost/thread/thread.hpp>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+#include <boost/detail/lightweight_test.hpp>
+
+class G
+{
+ int alive_;
+public:
+ static int n_alive;
+ static bool op_run;
+
+ G() :
+ alive_(1)
+ {
+ ++n_alive;
+ }
+ G(const G& g) :
+ alive_(g.alive_)
+ {
+ ++n_alive;
+ }
+ ~G()
+ {
+ alive_ = 0;
+ --n_alive;
+ }
+
+ void operator()()
+ {
+ BOOST_TEST(alive_ == 1);
+ BOOST_TEST(n_alive == 1);
+ op_run = true;
+ }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+ {
+ boost::thread t0( (G()));
+ BOOST_TEST(t0.joinable());
+ t0.join();
+ BOOST_TEST(!t0.joinable());
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/libs/thread/test/threads/thread/members/native_handle_pass.cpp b/libs/thread/test/threads/thread/members/native_handle_pass.cpp
new file mode 100644
index 0000000000..c35e9a8c2e
--- /dev/null
+++ b/libs/thread/test/threads/thread/members/native_handle_pass.cpp
@@ -0,0 +1,71 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// native_handle_type native_handle();
+
+#include <boost/thread/thread.hpp>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+#include <boost/detail/lightweight_test.hpp>
+
+class G
+{
+ int alive_;
+public:
+ static int n_alive;
+ static bool op_run;
+
+ G() :
+ alive_(1)
+ {
+ ++n_alive;
+ }
+ G(const G& g) :
+ alive_(g.alive_)
+ {
+ ++n_alive;
+ }
+ ~G()
+ {
+ alive_ = 0;
+ --n_alive;
+ }
+
+ void operator()()
+ {
+ BOOST_TEST(alive_ == 1);
+ //BOOST_TEST(n_alive == 1);
+ op_run = true;
+ }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+ {
+ boost::thread t0( (G()));
+ // boost::thread::native_handle_type hdl =
+ (void)t0.native_handle();
+ t0.join();
+ }
+
+ return boost::report_errors();
+}
+
diff --git a/libs/thread/test/threads/thread/members/swap_pass.cpp b/libs/thread/test/threads/thread/members/swap_pass.cpp
new file mode 100644
index 0000000000..6a8d590015
--- /dev/null
+++ b/libs/thread/test/threads/thread/members/swap_pass.cpp
@@ -0,0 +1,73 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// native_handle_type native_handle();
+
+#include <boost/thread/thread.hpp>
+#include <cstdlib>
+#include <boost/detail/lightweight_test.hpp>
+
+class G
+{
+ int alive_;
+public:
+ static int n_alive;
+ static bool op_run;
+
+ G() :
+ alive_(1)
+ {
+ ++n_alive;
+ }
+ G(const G& g) :
+ alive_(g.alive_)
+ {
+ ++n_alive;
+ }
+ ~G()
+ {
+ alive_ = 0;
+ --n_alive;
+ }
+
+ void operator()()
+ {
+ BOOST_TEST(alive_ == 1);
+ std::cout << n_alive << std::endl;
+ //BOOST_TEST(n_alive == 1);
+ op_run = true;
+ }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+ {
+ boost::thread t0( (G()));
+ boost::thread::id id0 = t0.get_id();
+ boost::thread t1;
+ boost::thread::id id1 = t1.get_id();
+ t0.swap(t1);
+ BOOST_TEST(t0.get_id() == id1);
+ BOOST_TEST(t1.get_id() == id0);
+ t1.join();
+ return boost::report_errors();
+ }
+}
+
diff --git a/libs/thread/test/threads/thread/non_members/swap_pass.cpp b/libs/thread/test/threads/thread/non_members/swap_pass.cpp
new file mode 100644
index 0000000000..dd05d61e5e
--- /dev/null
+++ b/libs/thread/test/threads/thread/non_members/swap_pass.cpp
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// void swap(thread& x, thread& y);
+
+#include <boost/thread/thread.hpp>
+#include <new>
+#include <cstdlib>
+#include <cassert>
+#include <boost/detail/lightweight_test.hpp>
+
+class G
+{
+ int alive_;
+public:
+ static int n_alive;
+ static bool op_run;
+
+ G() :
+ alive_(1)
+ {
+ ++n_alive;
+ }
+ G(const G& g) :
+ alive_(g.alive_)
+ {
+ ++n_alive;
+ }
+ ~G()
+ {
+ alive_ = 0;
+ --n_alive;
+ }
+
+ void operator()()
+ {
+ BOOST_TEST(alive_ == 1);
+ BOOST_TEST(n_alive == 1);
+ op_run = true;
+ }
+};
+
+int G::n_alive = 0;
+bool G::op_run = false;
+
+int main()
+{
+ {
+ boost::thread t0( (G()));
+ boost::thread::id id0 = t0.get_id();
+ boost::thread t1;
+ boost::thread::id id1 = t1.get_id();
+ swap(t0, t1);
+ BOOST_TEST(t0.get_id() == id1);
+ BOOST_TEST(t1.get_id() == id0);
+ t1.join();
+ }
+ return boost::report_errors();
+}
+
diff --git a/libs/thread/test/threads/thread/static/hardware_concurrency_pass.cpp b/libs/thread/test/threads/thread/static/hardware_concurrency_pass.cpp
new file mode 100644
index 0000000000..7d1581b520
--- /dev/null
+++ b/libs/thread/test/threads/thread/static/hardware_concurrency_pass.cpp
@@ -0,0 +1,28 @@
+//===----------------------------------------------------------------------===//
+//
+// 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/thread.hpp>
+
+// class thread
+
+// static unsigned hardware_concurrency();
+
+#include <boost/thread/thread.hpp>
+#include <boost/detail/lightweight_test.hpp>
+
+int main()
+{
+ BOOST_TEST(boost::thread::hardware_concurrency() > 0);
+ return boost::report_errors();
+}
+