Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82298 - trunk/boost/thread/detail
From: vicente.botet_at_[hidden]
Date: 2012-12-31 05:03:55


Author: viboes
Date: 2012-12-31 05:03:55 EST (Mon, 31 Dec 2012)
New Revision: 82298
URL: http://svn.boost.org/trac/boost/changeset/82298

Log:
Thread: change resource_deadlock_would_occur from precondition to exception.
Text files modified:
   trunk/boost/thread/detail/thread.hpp | 11 +++++------
   1 files changed, 5 insertions(+), 6 deletions(-)

Modified: trunk/boost/thread/detail/thread.hpp
==============================================================================
--- trunk/boost/thread/detail/thread.hpp (original)
+++ trunk/boost/thread/detail/thread.hpp 2012-12-31 05:03:55 EST (Mon, 31 Dec 2012)
@@ -743,9 +743,9 @@
     }
 #endif
     void thread::join() {
- BOOST_THREAD_ASSERT_PRECONDITION( this_thread::get_id() != get_id(),
- thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself")
- );
+ if (this_thread::get_id() == get_id())
+ boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself"));
+
         BOOST_THREAD_VERIFY_PRECONDITION( join_noexcept(),
             thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable")
         );
@@ -757,9 +757,8 @@
     bool thread::do_try_join_until(uintmax_t timeout)
 #endif
     {
- BOOST_THREAD_ASSERT_PRECONDITION( this_thread::get_id() != get_id(),
- thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself")
- );
+ if (this_thread::get_id() == get_id())
+ boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself"));
         bool res;
         if (do_try_join_until_noexcept(timeout, res))
         {


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