Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84954 - trunk/boost/thread
From: vicente.botet_at_[hidden]
Date: 2013-07-04 17:42:11


Author: viboes
Date: 2013-07-04 17:42:11 EDT (Thu, 04 Jul 2013)
New Revision: 84954
URL: http://svn.boost.org/trac/boost/changeset/84954

Log:
Thread: Added assertion on testable_mutex lock when the mutex is locked by this thread.

Text files modified:
   trunk/boost/thread/testable_mutex.hpp | 4 ++++
   1 files changed, 4 insertions(+), 0 deletions(-)

Modified: trunk/boost/thread/testable_mutex.hpp
==============================================================================
--- trunk/boost/thread/testable_mutex.hpp Thu Jul 4 17:40:15 2013 (r84953)
+++ trunk/boost/thread/testable_mutex.hpp 2013-07-04 17:42:11 EDT (Thu, 04 Jul 2013) (r84954)
@@ -48,6 +48,7 @@
 
     void lock()
     {
+ BOOST_ASSERT(! is_locked_by_this_thread());
       mtx_.lock();
       id_ = this_thread::get_id();
     }
@@ -61,6 +62,7 @@
 
     bool try_lock()
     {
+ BOOST_ASSERT(! is_locked_by_this_thread());
       if (mtx_.try_lock())
       {
         id_ = this_thread::get_id();
@@ -75,6 +77,7 @@
     template <class Rep, class Period>
     bool try_lock_for(const chrono::duration<Rep, Period>& rel_time)
     {
+ BOOST_ASSERT(! is_locked_by_this_thread());
       if (mtx_.try_lock_for(rel_time))
       {
         id_ = this_thread::get_id();
@@ -88,6 +91,7 @@
     template <class Clock, class Duration>
     bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time)
     {
+ BOOST_ASSERT(! is_locked_by_this_thread());
       if (mtx_.try_lock_until(abs_time))
       {
         id_ = this_thread::get_id();


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