mirror of
https://github.com/boostorg/thread.git
synced 2026-02-21 15:32:09 +00:00
Thread: Merged from trunk : 1.52
[SVN r80476]
This commit is contained in:
@@ -225,6 +225,7 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./sync/conditions/condition_variable_any/wait_until_pass.cpp : condition_variable_any__wait_until_p ]
|
||||
[ thread-run2 ./sync/conditions/condition_variable_any/wait_until_pred_pass.cpp : condition_variable_any__wait_until_pred_p ]
|
||||
[ thread-run2 ./sync/conditions/cv_status/cv_status_pass.cpp : cv_status__cv_status_p ]
|
||||
[ thread-run2 ./sync/conditions/notify_all_at_thread_exit_pass.cpp : notify_all_at_thread_exit_p ]
|
||||
;
|
||||
|
||||
explicit ts_async ;
|
||||
@@ -469,6 +470,8 @@ rule thread-compile-fail ( sources : reqs * : name )
|
||||
[ thread-run2 ./threads/thread/members/detach_pass.cpp : thread__detach_p ]
|
||||
[ thread-run2 ./threads/thread/members/get_id_pass.cpp : thread__get_id_p ]
|
||||
[ thread-run2 ./threads/thread/members/join_pass.cpp : thread__join_p ]
|
||||
[ thread-run2 ./threads/thread/members/try_join_until_pass.cpp : thread__join_until_p ]
|
||||
[ thread-run2 ./threads/thread/members/try_join_for_pass.cpp : thread__join_for_p ]
|
||||
[ thread-run2 ./threads/thread/members/joinable_pass.cpp : thread__joinable_p ]
|
||||
[ thread-run2 ./threads/thread/members/native_handle_pass.cpp : thread__native_handle_p ]
|
||||
[ thread-run2 ./threads/thread/members/swap_pass.cpp : thread__swap_p ]
|
||||
|
||||
51
test/sync/conditions/notify_all_at_thread_exit_pass.cpp
Normal file
51
test/sync/conditions/notify_all_at_thread_exit_pass.cpp
Normal file
@@ -0,0 +1,51 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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/condition_variable.hpp>
|
||||
|
||||
// void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
|
||||
|
||||
#define BOOST_THREAD_USES_MOVE
|
||||
#define BOOST_THREAD_VESRION 3
|
||||
|
||||
#include <boost/thread/condition_variable.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/locks.hpp>
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <boost/chrono/chrono.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
boost::condition_variable cv;
|
||||
boost::mutex mut;
|
||||
|
||||
typedef boost::chrono::milliseconds ms;
|
||||
typedef boost::chrono::high_resolution_clock Clock;
|
||||
|
||||
void func()
|
||||
{
|
||||
boost::unique_lock < boost::mutex > lk(mut);
|
||||
boost::notify_all_at_thread_exit(cv, boost::move(lk));
|
||||
boost::this_thread::sleep_for(ms(300));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
boost::unique_lock < boost::mutex > lk(mut);
|
||||
boost::thread(func).detach();
|
||||
Clock::time_point t0 = Clock::now();
|
||||
cv.wait(lk);
|
||||
Clock::time_point t1 = Clock::now();
|
||||
BOOST_TEST(t1 - t0 > ms(250));
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
@@ -33,6 +33,41 @@
|
||||
typedef boost::chrono::high_resolution_clock Clock;
|
||||
typedef boost::chrono::milliseconds ms;
|
||||
|
||||
class A
|
||||
{
|
||||
long data_;
|
||||
|
||||
public:
|
||||
typedef int result_type;
|
||||
|
||||
explicit A(long i) : data_(i) {}
|
||||
|
||||
long operator()() const
|
||||
{
|
||||
boost::this_thread::sleep_for(ms(200));
|
||||
return data_;
|
||||
}
|
||||
};
|
||||
|
||||
class MoveOnly
|
||||
{
|
||||
public:
|
||||
typedef int result_type;
|
||||
|
||||
BOOST_THREAD_MOVABLE_ONLY(MoveOnly)
|
||||
MoveOnly()
|
||||
{
|
||||
}
|
||||
MoveOnly(BOOST_THREAD_RV_REF(MoveOnly))
|
||||
{}
|
||||
|
||||
int operator()()
|
||||
{
|
||||
boost::this_thread::sleep_for(ms(200));
|
||||
return 3;
|
||||
}
|
||||
};
|
||||
|
||||
int f0()
|
||||
{
|
||||
boost::this_thread::sleep_for(ms(200));
|
||||
@@ -58,11 +93,14 @@ boost::interprocess::unique_ptr<int, boost::default_delete<int> > f3(int i)
|
||||
return boost::interprocess::unique_ptr<int, boost::default_delete<int> >(new int(i));
|
||||
}
|
||||
|
||||
//boost::interprocess::unique_ptr<int, boost::default_delete<int> > f4(boost::interprocess::unique_ptr<int, boost::default_delete<int> >&& p)
|
||||
//{
|
||||
// boost::this_thread::sleep_for(ms(200));
|
||||
// return boost::move(p);
|
||||
//}
|
||||
typedef boost::interprocess::unique_ptr<int, boost::default_delete<int> > XXT;
|
||||
boost::interprocess::unique_ptr<int, boost::default_delete<int> > f4(
|
||||
BOOST_THREAD_RV_REF(boost::interprocess::unique_ptr<int, boost::default_delete<int> > ) p)
|
||||
{
|
||||
boost::this_thread::sleep_for(ms(200));
|
||||
return boost::move(p);
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -82,6 +120,22 @@ int main()
|
||||
Clock::time_point t1 = Clock::now();
|
||||
BOOST_TEST(t1 - t0 < ms(100));
|
||||
}
|
||||
{
|
||||
boost::future<int> f = boost::async(boost::launch::async, A(3));
|
||||
boost::this_thread::sleep_for(ms(300));
|
||||
Clock::time_point t0 = Clock::now();
|
||||
BOOST_TEST(f.get() == 3);
|
||||
Clock::time_point t1 = Clock::now();
|
||||
BOOST_TEST(t1 - t0 < ms(100));
|
||||
}
|
||||
{
|
||||
boost::future<int> f = boost::async(boost::launch::async, BOOST_THREAD_MAKE_RV_REF(MoveOnly()));
|
||||
boost::this_thread::sleep_for(ms(300));
|
||||
Clock::time_point t0 = Clock::now();
|
||||
BOOST_TEST(f.get() == 3);
|
||||
Clock::time_point t1 = Clock::now();
|
||||
BOOST_TEST(t1 - t0 < ms(100));
|
||||
}
|
||||
{
|
||||
boost::future<int> f = boost::async(boost::launch::any, f0);
|
||||
boost::this_thread::sleep_for(ms(300));
|
||||
|
||||
@@ -89,14 +89,14 @@ int main()
|
||||
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);
|
||||
// }
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
// class thread
|
||||
|
||||
// void join();
|
||||
|
||||
#define BOOST_THREAD_VESRION 3
|
||||
#include <boost/thread/thread.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
@@ -53,7 +52,7 @@ public:
|
||||
void operator()()
|
||||
{
|
||||
BOOST_TEST(alive_ == 1);
|
||||
BOOST_TEST(n_alive == 1);
|
||||
//BOOST_TEST(n_alive == 1);
|
||||
op_run = true;
|
||||
}
|
||||
};
|
||||
@@ -68,8 +67,6 @@ void resource_deadlock_would_occur_tester()
|
||||
try
|
||||
{
|
||||
boost::unique_lock<boost::mutex> lk(resource_deadlock_would_occur_mtx);
|
||||
|
||||
|
||||
resource_deadlock_would_occur_th->join();
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
@@ -83,28 +80,6 @@ void resource_deadlock_would_occur_tester()
|
||||
}
|
||||
}
|
||||
|
||||
void throws_thread_resource_error_tester()
|
||||
{
|
||||
{
|
||||
try {
|
||||
boost::throw_exception(
|
||||
boost::thread_resource_error(
|
||||
boost::system::errc::resource_deadlock_would_occur,
|
||||
"boost thread: trying joining itself"
|
||||
));
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch (boost::system::system_error& e)
|
||||
{
|
||||
BOOST_TEST(e.code().value() == boost::system::errc::resource_deadlock_would_occur);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
BOOST_TEST(false&&"exception thrown");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
@@ -114,10 +89,6 @@ int main()
|
||||
BOOST_TEST(!t0.joinable());
|
||||
}
|
||||
|
||||
{
|
||||
boost::thread t0( throws_thread_resource_error_tester );
|
||||
t0.join();
|
||||
}
|
||||
{
|
||||
boost::unique_lock<boost::mutex> lk(resource_deadlock_would_occur_mtx);
|
||||
boost::thread t0( resource_deadlock_would_occur_tester );
|
||||
@@ -130,35 +101,34 @@ int main()
|
||||
BOOST_TEST(!t0.joinable());
|
||||
}
|
||||
|
||||
// {
|
||||
// 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);
|
||||
// }
|
||||
//
|
||||
// }
|
||||
{
|
||||
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::invalid_argument);
|
||||
}
|
||||
}
|
||||
{
|
||||
boost::thread t0( (G()));
|
||||
BOOST_TEST(t0.joinable());
|
||||
t0.join();
|
||||
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();
|
||||
}
|
||||
|
||||
161
test/threads/thread/members/try_join_for_pass.cpp
Normal file
161
test/threads/thread/members/try_join_for_pass.cpp
Normal file
@@ -0,0 +1,161 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 Rep, class Period>
|
||||
// bool try_join_for(const chrono::duration<Rep, Period>& rel_time);
|
||||
|
||||
#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>
|
||||
|
||||
#if defined BOOST_THREAD_USES_CHRONO
|
||||
|
||||
class G
|
||||
{
|
||||
int alive_;
|
||||
public:
|
||||
static bool op_run;
|
||||
|
||||
G() :
|
||||
alive_(1)
|
||||
{
|
||||
}
|
||||
G(const G& g) :
|
||||
alive_(g.alive_)
|
||||
{
|
||||
}
|
||||
~G()
|
||||
{
|
||||
alive_ = 0;
|
||||
}
|
||||
|
||||
void operator()()
|
||||
{
|
||||
BOOST_TEST(alive_ == 1);
|
||||
op_run = true;
|
||||
}
|
||||
};
|
||||
|
||||
bool G::op_run = false;
|
||||
|
||||
boost::thread* resource_deadlock_would_occur_th=0;
|
||||
boost::mutex resource_deadlock_would_occur_mtx;
|
||||
void resource_deadlock_would_occur_tester()
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::unique_lock<boost::mutex> lk(resource_deadlock_would_occur_mtx);
|
||||
resource_deadlock_would_occur_th->try_join_for(boost::chrono::milliseconds(50));
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch (boost::system::system_error& e)
|
||||
{
|
||||
BOOST_TEST(e.code().value() == boost::system::errc::resource_deadlock_would_occur);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
BOOST_TEST(false&&"exception thrown");
|
||||
}
|
||||
}
|
||||
|
||||
void th_100_ms()
|
||||
{
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
boost::thread t0( (G()));
|
||||
BOOST_TEST(t0.joinable());
|
||||
BOOST_TEST(t0.try_join_for(boost::chrono::milliseconds(50)));
|
||||
BOOST_TEST(!t0.joinable());
|
||||
}
|
||||
{
|
||||
boost::thread t0( (th_100_ms));
|
||||
BOOST_TEST(!t0.try_join_for(boost::chrono::milliseconds(50)));
|
||||
t0.join();
|
||||
}
|
||||
|
||||
{
|
||||
boost::unique_lock<boost::mutex> lk(resource_deadlock_would_occur_mtx);
|
||||
boost::thread t0( resource_deadlock_would_occur_tester );
|
||||
resource_deadlock_would_occur_th = &t0;
|
||||
BOOST_TEST(t0.joinable());
|
||||
lk.unlock();
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
|
||||
boost::unique_lock<boost::mutex> lk2(resource_deadlock_would_occur_mtx);
|
||||
t0.join();
|
||||
BOOST_TEST(!t0.joinable());
|
||||
}
|
||||
|
||||
{
|
||||
boost::thread t0( (G()));
|
||||
t0.detach();
|
||||
try
|
||||
{
|
||||
t0.try_join_for(boost::chrono::milliseconds(50));
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch (boost::system::system_error& e)
|
||||
{
|
||||
BOOST_TEST(e.code().value() == boost::system::errc::invalid_argument);
|
||||
}
|
||||
}
|
||||
{
|
||||
boost::thread t0( (G()));
|
||||
BOOST_TEST(t0.joinable());
|
||||
t0.join();
|
||||
try
|
||||
{
|
||||
t0.try_join_for(boost::chrono::milliseconds(50));
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch (boost::system::system_error& e)
|
||||
{
|
||||
BOOST_TEST(e.code().value() == boost::system::errc::invalid_argument);
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
boost::thread t0( (G()));
|
||||
BOOST_TEST(t0.joinable());
|
||||
t0.try_join_for(boost::chrono::milliseconds(50));
|
||||
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();
|
||||
}
|
||||
|
||||
#else
|
||||
#error "Test not applicable: BOOST_THREAD_USES_CHRONO not defined for this platform as not supported"
|
||||
#endif
|
||||
162
test/threads/thread/members/try_join_until_pass.cpp
Normal file
162
test/threads/thread/members/try_join_until_pass.cpp
Normal file
@@ -0,0 +1,162 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// 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 Clock, class Duration>
|
||||
// bool try_join_until(const chrono::time_point<Clock, Duration>& t);
|
||||
|
||||
#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>
|
||||
|
||||
#if defined BOOST_THREAD_USES_CHRONO
|
||||
|
||||
class G
|
||||
{
|
||||
int alive_;
|
||||
public:
|
||||
static bool op_run;
|
||||
|
||||
G() :
|
||||
alive_(1)
|
||||
{
|
||||
}
|
||||
G(const G& g) :
|
||||
alive_(g.alive_)
|
||||
{
|
||||
}
|
||||
~G()
|
||||
{
|
||||
alive_ = 0;
|
||||
}
|
||||
|
||||
void operator()()
|
||||
{
|
||||
BOOST_TEST(alive_ == 1);
|
||||
op_run = true;
|
||||
}
|
||||
};
|
||||
|
||||
bool G::op_run = false;
|
||||
|
||||
boost::thread* resource_deadlock_would_occur_th=0;
|
||||
boost::mutex resource_deadlock_would_occur_mtx;
|
||||
void resource_deadlock_would_occur_tester()
|
||||
{
|
||||
try
|
||||
{
|
||||
boost::unique_lock<boost::mutex> lk(resource_deadlock_would_occur_mtx);
|
||||
resource_deadlock_would_occur_th->try_join_until(boost::chrono::steady_clock::now()+boost::chrono::milliseconds(50));
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch (boost::system::system_error& e)
|
||||
{
|
||||
BOOST_TEST(e.code().value() == boost::system::errc::resource_deadlock_would_occur);
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
BOOST_TEST(false&&"exception thrown");
|
||||
}
|
||||
}
|
||||
|
||||
void th_100_ms()
|
||||
{
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
boost::thread t0( (G()));
|
||||
BOOST_TEST(t0.joinable());
|
||||
t0.try_join_until(boost::chrono::steady_clock::now()+boost::chrono::milliseconds(50));
|
||||
BOOST_TEST(!t0.joinable());
|
||||
}
|
||||
{
|
||||
boost::thread t0( (th_100_ms));
|
||||
BOOST_TEST(!t0.try_join_until(boost::chrono::steady_clock::now()+boost::chrono::milliseconds(50)));
|
||||
t0.join();
|
||||
}
|
||||
|
||||
{
|
||||
boost::unique_lock<boost::mutex> lk(resource_deadlock_would_occur_mtx);
|
||||
boost::thread t0( resource_deadlock_would_occur_tester );
|
||||
resource_deadlock_would_occur_th = &t0;
|
||||
BOOST_TEST(t0.joinable());
|
||||
lk.unlock();
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
|
||||
boost::unique_lock<boost::mutex> lk2(resource_deadlock_would_occur_mtx);
|
||||
t0.join();
|
||||
BOOST_TEST(!t0.joinable());
|
||||
}
|
||||
|
||||
{
|
||||
boost::thread t0( (G()));
|
||||
t0.detach();
|
||||
try
|
||||
{
|
||||
t0.try_join_until(boost::chrono::steady_clock::now()+boost::chrono::milliseconds(50));
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch (boost::system::system_error& e)
|
||||
{
|
||||
BOOST_TEST(e.code().value() == boost::system::errc::invalid_argument);
|
||||
}
|
||||
}
|
||||
{
|
||||
boost::thread t0( (G()));
|
||||
BOOST_TEST(t0.joinable());
|
||||
t0.join();
|
||||
try
|
||||
{
|
||||
t0.try_join_until(boost::chrono::steady_clock::now()+boost::chrono::milliseconds(50));
|
||||
BOOST_TEST(false);
|
||||
}
|
||||
catch (boost::system::system_error& e)
|
||||
{
|
||||
BOOST_TEST(e.code().value() == boost::system::errc::invalid_argument);
|
||||
}
|
||||
|
||||
}
|
||||
{
|
||||
boost::thread t0( (G()));
|
||||
BOOST_TEST(t0.joinable());
|
||||
t0.try_join_until(boost::chrono::steady_clock::now()+boost::chrono::milliseconds(50));
|
||||
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();
|
||||
}
|
||||
|
||||
#else
|
||||
#error "Test not applicable: BOOST_THREAD_USES_CHRONO not defined for this platform as not supported"
|
||||
#endif
|
||||
Reference in New Issue
Block a user