|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67734 - trunk/boost/thread/pthread
From: anthony_at_[hidden]
Date: 2011-01-06 17:50:00
Author: anthonyw
Date: 2011-01-06 17:49:41 EST (Thu, 06 Jan 2011)
New Revision: 67734
URL: http://svn.boost.org/trac/boost/changeset/67734
Log:
Throw condition_error if pthread_cond_wait fails, rather than asserting
Text files modified:
trunk/boost/thread/pthread/condition_variable.hpp | 23 ++++++++++++++++-------
1 files changed, 16 insertions(+), 7 deletions(-)
Modified: trunk/boost/thread/pthread/condition_variable.hpp
==============================================================================
--- trunk/boost/thread/pthread/condition_variable.hpp (original)
+++ trunk/boost/thread/pthread/condition_variable.hpp 2011-01-06 17:49:41 EST (Thu, 06 Jan 2011)
@@ -47,12 +47,18 @@
inline void condition_variable::wait(unique_lock<mutex>& m)
{
- thread_cv_detail::lock_on_exit<unique_lock<mutex> > guard;
- detail::interruption_checker check_for_interruption(&internal_mutex,&cond);
- guard.activate(m);
- int const res=pthread_cond_wait(&cond,&internal_mutex);
- BOOST_ASSERT(!res);
- this_thread::interruption_point();
+ int res=0;
+ {
+ thread_cv_detail::lock_on_exit<unique_lock<mutex> > guard;
+ detail::interruption_checker check_for_interruption(&internal_mutex,&cond);
+ guard.activate(m);
+ res=pthread_cond_wait(&cond,&internal_mutex);
+ this_thread::interruption_point();
+ }
+ if(res)
+ {
+ boost::throw_exception(condition_error());
+ }
}
inline bool condition_variable::timed_wait(unique_lock<mutex>& m,boost::system_time const& wait_until)
@@ -67,7 +73,10 @@
{
return false;
}
- BOOST_ASSERT(!cond_res);
+ if(cond_res)
+ {
+ boost::throw_exception(condition_error());
+ }
return true;
}
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