mirror of
https://github.com/boostorg/thread.git
synced 2026-01-23 18:12:12 +00:00
* [@http://svn.boost.org/trac/boost/ticket/6195 #6195] c++11 compliance: Provide the standard time related interface using Boost.Chrono. * [@http://svn.boost.org/trac/boost/ticket/6224 #6224] c++11 compliance: Add the use of standard noexcept on compilers supporting them. * [@http://svn.boost.org/trac/boost/ticket/6226 #6226] c++11 compliance: Add explicit bool conversion from locks. * [@http://svn.boost.org/trac/boost/ticket/6230 #6230] c++11 compliance: Follows the exception reporting mechanism as defined in the c++11. * [@http://svn.boost.org/trac/boost/ticket/6272 #6272] c++11 compliance: Add thread::id hash specialization. * [@http://svn.boost.org/trac/boost/ticket/6273 #6273] c++11 compliance: Add cv_status enum class and use it on the conditions wait functions. * [@http://svn.boost.org/trac/boost/ticket/6194 #6194] Adapt to Boost.Move. Fixed Bugs: * [@http://svn.boost.org/trac/boost/ticket/2575 #2575] Bug- Boost 1.36.0 on Itanium platform. * [@http://svn.boost.org/trac/boost/ticket/4921 #4921] BOOST_THREAD_USE_DLL and BOOST_THREAD_USE_LIB are crucial and need to be documented. * [@http://svn.boost.org/trac/boost/ticket/5013 #5013] documentation: boost:🧵 pthreas_exit causes terminate(). * [@http://svn.boost.org/trac/boost/ticket/5351 #5351] interrupt a future get boost::unknown_exception. * [@http://svn.boost.org/trac/boost/ticket/5516 #5516] Upgrade lock is not acquired when previous upgrade lock releases if another read lock is present. * [@http://svn.boost.org/trac/boost/ticket/5990 #5990] shared_future<T>::get() has wrong return type. * [@http://svn.boost.org/trac/boost/ticket/6174 #6174] packaged_task doesn't correctly handle moving results. [SVN r76543]
63 lines
1.5 KiB
C++
Executable File
63 lines
1.5 KiB
C++
Executable File
// Copyright (C) 2010 Vicente Botet
|
|
//
|
|
// 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 <boost/test/unit_test.hpp>
|
|
|
|
#include <iostream>
|
|
|
|
#include <boost/thread.hpp>
|
|
|
|
using namespace std;
|
|
|
|
boost::mutex mutex_;
|
|
|
|
void perform()
|
|
{
|
|
try
|
|
{
|
|
boost::this_thread::sleep(boost::posix_time::seconds(100));
|
|
}
|
|
catch(boost::thread_interrupted& interrupt)
|
|
{
|
|
boost::mutex::scoped_lock lock(mutex_);
|
|
cerr << "Thread " << boost::this_thread::get_id() << " got interrupted" << endl;
|
|
throw(interrupt);
|
|
}
|
|
catch(std::exception& e)
|
|
{
|
|
boost::mutex::scoped_lock lock(mutex_);
|
|
cerr << "Thread " << boost::this_thread::get_id() << " caught std::exception" << e.what() << endl;
|
|
}
|
|
catch(...)
|
|
{
|
|
boost::mutex::scoped_lock lock(mutex_);
|
|
cerr << "Thread " << boost::this_thread::get_id() << " caught something else" << endl;
|
|
}
|
|
}
|
|
|
|
void test()
|
|
{
|
|
boost::thread_group threads;
|
|
|
|
for (int i = 0; i < 2; ++i)
|
|
{
|
|
threads.create_thread(perform);
|
|
}
|
|
|
|
//boost::this_thread::sleep(1);
|
|
threads.interrupt_all();
|
|
threads.join_all();
|
|
}
|
|
|
|
boost::unit_test_framework::test_suite* init_unit_test_suite(int, char*[])
|
|
{
|
|
boost::unit_test_framework::test_suite* tests =
|
|
BOOST_TEST_SUITE("Boost.Threads: 2309");
|
|
|
|
tests->add(BOOST_TEST_CASE(&test));
|
|
|
|
return tests;
|
|
}
|