Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85803 - in trunk/boost/sync: detail/mutexes locks
From: andrey.semashev_at_[hidden]
Date: 2013-09-20 12:49:51


Author: andysem
Date: 2013-09-20 12:49:51 EDT (Fri, 20 Sep 2013)
New Revision: 85803
URL: http://svn.boost.org/trac/boost/changeset/85803

Log:
Fixed compilation on OS X.

Text files modified:
   trunk/boost/sync/detail/mutexes/timed_mutex_posix.hpp | 4 +---
   trunk/boost/sync/locks/unique_lock.hpp | 36 ++++++------------------------------
   2 files changed, 7 insertions(+), 33 deletions(-)

Modified: trunk/boost/sync/detail/mutexes/timed_mutex_posix.hpp
==============================================================================
--- trunk/boost/sync/detail/mutexes/timed_mutex_posix.hpp Fri Sep 20 10:39:56 2013 (r85802)
+++ trunk/boost/sync/detail/mutexes/timed_mutex_posix.hpp 2013-09-20 12:49:51 EDT (Fri, 20 Sep 2013) (r85803)
@@ -28,9 +28,7 @@
 #include <boost/sync/detail/pthread.hpp>
 #include <boost/sync/detail/time_traits.hpp>
 #include <boost/sync/detail/time_units.hpp>
-#if defined(BOOST_SYNC_DETAIL_PTHREAD_HAS_TIMEDLOCK)
 #include <boost/sync/detail/pthread_mutex_locks.hpp>
-#endif
 #include <boost/sync/detail/header.hpp>
 
 #ifdef BOOST_HAS_PRAGMA_ONCE
@@ -236,7 +234,7 @@
             if (cond_res == ETIMEDOUT)
                 return false;
             else if (cond_res != 0)
- BOOST_THROW_EXCEPTION(lock_error(res, "boost: timed_mutex timedlock failed in pthread_cond_timedwait"));
+ BOOST_THROW_EXCEPTION(lock_error(cond_res, "boost: timed_mutex timedlock failed in pthread_cond_timedwait"));
         }
         m_is_locked = true;
         return true;

Modified: trunk/boost/sync/locks/unique_lock.hpp
==============================================================================
--- trunk/boost/sync/locks/unique_lock.hpp Fri Sep 20 10:39:56 2013 (r85802)
+++ trunk/boost/sync/locks/unique_lock.hpp 2013-09-20 12:49:51 EDT (Fri, 20 Sep 2013) (r85803)
@@ -54,10 +54,6 @@
     mutex_type* m_mutex;
     bool m_is_locked;
 
-private:
- explicit unique_lock(upgrade_lock< mutex_type >&);
- unique_lock& operator= (upgrade_lock< mutex_type >& other);
-
 public:
     BOOST_MOVABLE_BUT_NOT_COPYABLE(unique_lock)
 
@@ -104,9 +100,7 @@
         m_mutex(that.m_mutex), m_is_locked(that.m_is_locked)
     {
         if (m_is_locked)
- {
             m_mutex->unlock_upgrade_and_lock();
- }
         that.release();
     }
 
@@ -186,13 +180,10 @@
     void lock()
     {
         if (!m_mutex)
- {
             BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost unique_lock has no mutex"));
- }
+
         if (m_is_locked)
- {
             BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::resource_deadlock_would_occur, "boost unique_lock already owns the mutex"));
- }
 
         m_mutex->lock();
         m_is_locked = true;
@@ -201,13 +192,10 @@
     bool try_lock()
     {
         if (!m_mutex)
- {
             BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost unique_lock has no mutex"));
- }
+
         if (m_is_locked)
- {
             BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::resource_deadlock_would_occur, "boost unique_lock already owns the mutex"));
- }
 
         m_is_locked = m_mutex->try_lock();
 
@@ -218,13 +206,10 @@
     typename enable_if_c< detail::time_traits< Time >::is_specialized, bool >::type timed_lock(Time const& time)
     {
         if (!m_mutex)
- {
             BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost unique_lock has no mutex"));
- }
+
         if (m_is_locked)
- {
             BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::resource_deadlock_would_occur, "boost unique_lock already owns the mutex"));
- }
 
         m_is_locked = m_mutex->timed_lock(time);
 
@@ -235,13 +220,10 @@
     typename detail::enable_if_tag< Duration, detail::time_duration_tag, bool >::type try_lock_for(Duration const& rel_time)
     {
         if (!m_mutex)
- {
             BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost unique_lock has no mutex"));
- }
+
         if (m_is_locked)
- {
             BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::resource_deadlock_would_occur, "boost unique_lock already owns the mutex"));
- }
 
         m_is_locked = m_mutex->try_lock_for(rel_time);
 
@@ -252,13 +234,10 @@
     typename detail::enable_if_tag< TimePoint, detail::time_point_tag, bool >::type try_lock_until(TimePoint const& abs_time)
     {
         if (!m_mutex)
- {
             BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost unique_lock has no mutex"));
- }
+
         if (m_is_locked)
- {
             BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::resource_deadlock_would_occur, "boost unique_lock already owns the mutex"));
- }
 
         m_is_locked = m_mutex->try_lock_until(abs_time);
 
@@ -268,13 +247,10 @@
     void unlock()
     {
         if (!m_mutex)
- {
             BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost unique_lock has no mutex"));
- }
+
         if (!m_is_locked)
- {
             BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost unique_lock doesn't own the mutex"));
- }
 
         m_mutex->unlock();
         m_is_locked = false;


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