|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r85968 - in trunk/boost/sync: detail detail/event detail/semaphore exceptions locks
From: andrey.semashev_at_[hidden]
Date: 2013-09-26 16:55:47
Author: andysem
Date: 2013-09-26 16:55:46 EDT (Thu, 26 Sep 2013)
New Revision: 85968
URL: http://svn.boost.org/trac/boost/changeset/85968
Log:
Fixed building with clang + libstdc++ in C++03 mode. Shortened namespace aliases and made std/boost::atomic selection similar to std/boost::system_error.
Text files modified:
trunk/boost/sync/detail/atomic.hpp | 46 ++++++++++++---------------------------
trunk/boost/sync/detail/event/event_autoreset_semaphore.hpp | 44 +++++++++++++++++--------------------
trunk/boost/sync/detail/event/event_futex.hpp | 12 +++------
trunk/boost/sync/detail/event/event_mach.hpp | 37 +++++++++++++++++--------------
trunk/boost/sync/detail/semaphore/semaphore_dispatch.hpp | 2
trunk/boost/sync/detail/semaphore/semaphore_mach.hpp | 2
trunk/boost/sync/detail/system_error.hpp | 4 +-
trunk/boost/sync/exceptions/runtime_exception.hpp | 8 +++---
trunk/boost/sync/locks/shared_lock.hpp | 24 ++++++++++----------
trunk/boost/sync/locks/unique_lock.hpp | 24 ++++++++++----------
trunk/boost/sync/locks/upgrade_lock.hpp | 24 ++++++++++----------
11 files changed, 102 insertions(+), 125 deletions(-)
Modified: trunk/boost/sync/detail/atomic.hpp
==============================================================================
--- trunk/boost/sync/detail/atomic.hpp Thu Sep 26 14:53:07 2013 (r85967)
+++ trunk/boost/sync/detail/atomic.hpp 2013-09-26 16:55:46 EDT (Thu, 26 Sep 2013) (r85968)
@@ -9,22 +9,29 @@
#ifndef BOOST_SYNC_DETAIL_ATOMIC_HPP
#define BOOST_SYNC_DETAIL_ATOMIC_HPP
+#include <boost/sync/detail/config.hpp>
+
#if !defined(BOOST_SYNC_USE_STD_ATOMIC)
-#if BOOST_CLANG
-#if __has_include( <atomic> )
+#if defined(BOOST_CLANG)
+
+// Clang can be used with libstdc++, which only enables C++11 headers when explicitly enabled in the command line.
+#if (__cplusplus >= 201103L) && __has_include( <atomic> )
#define BOOST_SYNC_USE_STD_ATOMIC
#endif
-#endif
-#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1700)
+#elif defined(BOOST_MSVC)
+
+#if (BOOST_MSVC >= 1700)
#define BOOST_SYNC_USE_STD_ATOMIC
#endif
-#if BOOST_GCC
+#elif defined(BOOST_GCC)
+
#if (BOOST_GCC >= 40800) && (__cplusplus >= 201103L)
#define BOOST_SYNC_USE_STD_ATOMIC
#endif
+
#endif
#endif // !defined(BOOST_SYNC_USE_STD_ATOMIC)
@@ -35,7 +42,6 @@
#include <boost/atomic.hpp>
#endif
-#include <boost/sync/detail/config.hpp>
#include <boost/sync/detail/header.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
@@ -48,33 +54,11 @@
#ifdef BOOST_SYNC_USE_STD_ATOMIC
-using std::atomic;
-using std::atomic_int;
-using std::atomic_bool;
-
-using std::memory_order_acquire;
-using std::memory_order_acq_rel;
-using std::memory_order_release;
-using std::memory_order_consume;
-using std::memory_order_relaxed;
-using std::memory_order_seq_cst;
-
-using std::atomic_thread_fence;
+namespace atomic_ns = std;
#else
-using boost::atomic;
-using boost::atomic_int;
-using boost::atomic_bool;
-
-using boost::memory_order_acquire;
-using boost::memory_order_release;
-using boost::memory_order_acq_rel;
-using boost::memory_order_consume;
-using boost::memory_order_relaxed;
-using boost::memory_order_seq_cst;
-
-using boost::atomic_thread_fence;
+namespace atomic_ns = boost;
#endif
@@ -82,8 +66,6 @@
}
}
-#undef BOOST_SYNC_USE_STD_ATOMIC
-
#include <boost/sync/detail/footer.hpp>
#endif // BOOST_SYNC_DETAIL_ATOMIC_HPP
Modified: trunk/boost/sync/detail/event/event_autoreset_semaphore.hpp
==============================================================================
--- trunk/boost/sync/detail/event/event_autoreset_semaphore.hpp Thu Sep 26 14:53:07 2013 (r85967)
+++ trunk/boost/sync/detail/event/event_autoreset_semaphore.hpp 2013-09-26 16:55:46 EDT (Thu, 26 Sep 2013) (r85968)
@@ -34,17 +34,19 @@
BOOST_DELETED_FUNCTION(event& operator=(event const&));
public:
- explicit event():
- m_state(0)
- {}
+ event() : m_state(0)
+ {
+ }
void post() BOOST_NOEXCEPT
{
- using namespace boost::sync::detail; // for memory_order
- int32_t old_state = m_state.load(memory_order_acquire);
- if (old_state >= 0) {
- for (;;) {
- if (m_state.compare_exchange_weak( old_state, old_state - 1, memory_order_release, memory_order_acquire)) {
+ int32_t old_state = m_state.load(detail::atomic_ns::memory_order_acquire);
+ if (old_state >= 0)
+ {
+ for (;;)
+ {
+ if (m_state.compare_exchange_weak( old_state, old_state - 1, detail::atomic_ns::memory_order_release, detail::atomic_ns::memory_order_acquire))
+ {
m_sem.post();
return; // avoid unnecessary fence
}
@@ -56,67 +58,61 @@
}
}
- atomic_thread_fence( memory_order_release );
+ detail::atomic_ns::atomic_thread_fence(detail::atomic_ns::memory_order_release);
}
void reset() BOOST_NOEXCEPT
{
- m_state = 0;
+ m_state.store(0, detail::atomic_ns::memory_order_relaxed);
}
void wait()
{
- m_state.fetch_add(1, memory_order_acquire);
+ m_state.fetch_add(1, detail::atomic_ns::memory_order_acquire);
m_sem.wait();
}
bool try_wait()
{
- using namespace boost::sync::detail; // for memory_order
-
- m_state.fetch_add(1, memory_order_acquire);
+ m_state.fetch_add(1, detail::atomic_ns::memory_order_acquire);
const bool wait_successful = m_sem.try_wait();
if (wait_successful)
return true;
- m_state.fetch_add(-1, memory_order_relaxed);
+ m_state.fetch_add(-1, detail::atomic_ns::memory_order_relaxed);
return false;
}
template <typename Duration>
bool try_wait_for(const chrono::duration<Rep, Period> & duration)
{
- using namespace boost::sync::detail; // for memory_order
-
- m_state.fetch_add(1, memory_order_acquire);
+ m_state.fetch_add(1, detail::atomic_ns::memory_order_acquire);
const bool wait_successful = m_sem.try_wait_for( duration );
if (wait_successful)
return true;
- m_state.fetch_add(-1, memory_order_relaxed);
+ m_state.fetch_add(-1, detail::atomic_ns::memory_order_relaxed);
return false;
}
template <typename Timepoint>
bool try_wait_until(const Timepoint & timeout )
{
- using namespace boost::sync::detail; // for memory_order
-
- m_state.fetch_add(1, memory_order_acquire);
+ m_state.fetch_add(1, detail::atomic_ns::memory_order_acquire);
const bool wait_successful = m_sem.try_wait_until( timeout );
if (wait_successful)
return true;
- m_state.fetch_add(-1, memory_order_relaxed);
+ m_state.fetch_add(-1, detail::atomic_ns::memory_order_relaxed);
return false;
}
private:
semaphore m_sem;
- detail::atomic<int32_t> m_state;
+ detail::atomic_ns::atomic<int32_t> m_state;
};
}
Modified: trunk/boost/sync/detail/event/event_futex.hpp
==============================================================================
--- trunk/boost/sync/detail/event/event_futex.hpp Thu Sep 26 14:53:07 2013 (r85967)
+++ trunk/boost/sync/detail/event/event_futex.hpp 2013-09-26 16:55:46 EDT (Thu, 26 Sep 2013) (r85968)
@@ -39,7 +39,6 @@
void post() BOOST_NOEXCEPT
{
- using namespace boost::sync::detail; // for memory_order
if (m_auto_reset) {
int32_t old_state = m_state.load();
if (old_state >= 0) {
@@ -60,7 +59,6 @@
void wait() BOOST_NOEXCEPT
{
- using namespace boost::sync::detail; // for memory_order
if (m_auto_reset) {
int32_t old_state = m_state.fetch_add(1) + 1;
@@ -84,7 +82,7 @@
} else {
try_again:
- if ( m_state.load(memory_order_acquire) == 1 )
+ if ( m_state.load(detail::atomic_ns::memory_order_acquire) == 1 )
return; // fast-path
const long status = futex(&m_state, FUTEX_WAIT_PRIVATE, 0);
@@ -106,7 +104,6 @@
bool try_wait()
{
- using namespace boost::sync::detail; // for memory_order
if (m_auto_reset) {
int32_t old_state = m_state.load();
@@ -123,7 +120,7 @@
return false;
} else {
- if ( m_state.load(memory_order_acquire) == 1 )
+ if ( m_state.load(detail::atomic_ns::memory_order_acquire) == 1 )
return true; // fast-path
else
return false;
@@ -151,7 +148,6 @@
private:
bool do_wait_for(const struct timespec & timeout)
{
- using namespace boost::sync::detail; // for memory_order
if (m_auto_reset) {
int32_t old_state = m_state.fetch_add(1) + 1;
@@ -178,7 +174,7 @@
} else {
try_again:
- if ( m_state.load(memory_order_acquire) == 1 )
+ if ( m_state.load(detail::atomic_ns::memory_order_acquire) == 1 )
return true; // fast-path
const long status = futex(&m_state, FUTEX_WAIT_PRIVATE, 0, &timeout);
@@ -210,7 +206,7 @@
const bool m_auto_reset;
- detail::atomic<int32_t> m_state;
+ detail::atomic_ns::atomic<int32_t> m_state;
};
}
Modified: trunk/boost/sync/detail/event/event_mach.hpp
==============================================================================
--- trunk/boost/sync/detail/event/event_mach.hpp Thu Sep 26 14:53:07 2013 (r85967)
+++ trunk/boost/sync/detail/event/event_mach.hpp 2013-09-26 16:55:46 EDT (Thu, 26 Sep 2013) (r85968)
@@ -53,12 +53,15 @@
void post() BOOST_NOEXCEPT
{
- using namespace boost::sync::detail; // for memory_order
- if (m_auto_reset) {
- int32_t old_state = m_state.load(memory_order_acquire);
- if (old_state >= 0) {
- for (;;) {
- if (m_state.compare_exchange_weak( old_state, old_state - 1, memory_order_release, memory_order_acquire)) {
+ if (m_auto_reset)
+ {
+ int32_t old_state = m_state.load(detail::atomic_ns::memory_order_acquire);
+ if (old_state >= 0)
+ {
+ for (;;)
+ {
+ if (m_state.compare_exchange_weak( old_state, old_state - 1, detail::atomic_ns::memory_order_release, detail::atomic_ns::memory_order_acquire))
+ {
semaphore_signal( m_sem );
return; // avoid unnecessary fence
}
@@ -70,9 +73,11 @@
}
}
- detail::atomic_thread_fence( memory_order_release );
- } else {
- m_state.store( 1, memory_order_release );
+ detail::atomic_ns::atomic_thread_fence( detail::atomic_ns::memory_order_release );
+ }
+ else
+ {
+ m_state.store( 1, detail::atomic_ns::memory_order_release );
semaphore_signal_all( m_sem ); // wake all threads!& reset semaphore count
}
}
@@ -84,14 +89,13 @@
void wait() BOOST_NOEXCEPT
{
- using namespace boost::sync::detail; // for memory_order
if (m_auto_reset) {
- m_state.fetch_add(1, memory_order_acquire);
+ m_state.fetch_add(1, detail::atomic_ns::memory_order_acquire);
kern_return_t result = semaphore_wait( m_sem );
BOOST_VERIFY (result == KERN_SUCCESS);
} else {
- if (m_state.load(memory_order_acquire) == 1)
+ if (m_state.load(detail::atomic_ns::memory_order_acquire) == 1)
return;
kern_return_t result = semaphore_wait( m_sem );
@@ -124,19 +128,18 @@
private:
bool do_try_wait_until (const mach_timespec_t & timeout)
{
- using namespace boost::sync::detail; // for memory_order
if (m_auto_reset) {
- m_state.fetch_add(1, memory_order_acquire);
+ m_state.fetch_add(1, detail::atomic_ns::memory_order_acquire);
kern_return_t result = semaphore_timedwait( m_sem, timeout );
if (result == KERN_SUCCESS)
return true;
- m_state.fetch_add(-1, memory_order_relaxed);
+ m_state.fetch_add(-1, detail::atomic_ns::memory_order_relaxed);
return false;
} else {
- if (m_state.load( memory_order_acquire ) == 1)
+ if (m_state.load( detail::atomic_ns::memory_order_acquire ) == 1)
return true;
kern_return_t result = semaphore_timedwait( m_sem, timeout );
@@ -149,7 +152,7 @@
const bool m_auto_reset;
semaphore_t m_sem;
- detail::atomic<int32_t> m_state;
+ detail::atomic_ns::atomic<int32_t> m_state;
};
}
Modified: trunk/boost/sync/detail/semaphore/semaphore_dispatch.hpp
==============================================================================
--- trunk/boost/sync/detail/semaphore/semaphore_dispatch.hpp Thu Sep 26 14:53:07 2013 (r85967)
+++ trunk/boost/sync/detail/semaphore/semaphore_dispatch.hpp 2013-09-26 16:55:46 EDT (Thu, 26 Sep 2013) (r85968)
@@ -44,7 +44,7 @@
{
m_sem = dispatch_semaphore_create(i);
if (m_sem == NULL)
- BOOST_THROW_EXCEPTION(resource_error(sync::detail::system_namespace::errc::not_enough_memory, "boost::sync::semaphore constructor failed in dispatch_semaphore_create"));
+ BOOST_THROW_EXCEPTION(resource_error(sync::detail::system_ns::errc::not_enough_memory, "boost::sync::semaphore constructor failed in dispatch_semaphore_create"));
}
~semaphore() BOOST_NOEXCEPT
Modified: trunk/boost/sync/detail/semaphore/semaphore_mach.hpp
==============================================================================
--- trunk/boost/sync/detail/semaphore/semaphore_mach.hpp Thu Sep 26 14:53:07 2013 (r85967)
+++ trunk/boost/sync/detail/semaphore/semaphore_mach.hpp 2013-09-26 16:55:46 EDT (Thu, 26 Sep 2013) (r85968)
@@ -48,7 +48,7 @@
{
kern_return_t result = semaphore_create(mach_task_self(), &m_sem, SYNC_POLICY_FIFO, 0);
if (result != KERN_SUCCESS)
- BOOST_THROW_EXCEPTION(resource_error(sync::detail::system_namespace::errc::not_enough_memory, "boost::sync::semaphore constructor failed in semaphore_create"));
+ BOOST_THROW_EXCEPTION(resource_error(sync::detail::system_ns::errc::not_enough_memory, "boost::sync::semaphore constructor failed in semaphore_create"));
}
~semaphore() BOOST_NOEXCEPT
Modified: trunk/boost/sync/detail/system_error.hpp
==============================================================================
--- trunk/boost/sync/detail/system_error.hpp Thu Sep 26 14:53:07 2013 (r85967)
+++ trunk/boost/sync/detail/system_error.hpp 2013-09-26 16:55:46 EDT (Thu, 26 Sep 2013) (r85968)
@@ -35,9 +35,9 @@
namespace detail {
#if defined(BOOST_SYNC_USE_STD_SYSTEM_ERROR)
-namespace system_namespace = std;
+namespace system_ns = std;
#else
-namespace system_namespace = boost::system;
+namespace system_ns = boost::system;
#endif
} // namespace detail
Modified: trunk/boost/sync/exceptions/runtime_exception.hpp
==============================================================================
--- trunk/boost/sync/exceptions/runtime_exception.hpp Thu Sep 26 14:53:07 2013 (r85967)
+++ trunk/boost/sync/exceptions/runtime_exception.hpp 2013-09-26 16:55:46 EDT (Thu, 26 Sep 2013) (r85968)
@@ -28,20 +28,20 @@
namespace sync {
class BOOST_SYMBOL_VISIBLE runtime_exception :
- public sync::detail::system_namespace::system_error
+ public sync::detail::system_ns::system_error
{
public:
- explicit runtime_exception(int sys_err = 0) : sync::detail::system_namespace::system_error(sys_err, sync::detail::system_namespace::system_category())
+ explicit runtime_exception(int sys_err = 0) : sync::detail::system_ns::system_error(sys_err, sync::detail::system_ns::system_category())
{
}
runtime_exception(int sys_err, const char* what) :
- sync::detail::system_namespace::system_error(sync::detail::system_namespace::error_code(sys_err, sync::detail::system_namespace::system_category()), what)
+ sync::detail::system_ns::system_error(sync::detail::system_ns::error_code(sys_err, sync::detail::system_ns::system_category()), what)
{
}
runtime_exception(int sys_err, std::string const& what) :
- sync::detail::system_namespace::system_error(sync::detail::system_namespace::error_code(sys_err, sync::detail::system_namespace::system_category()), what)
+ sync::detail::system_ns::system_error(sync::detail::system_ns::error_code(sys_err, sync::detail::system_ns::system_category()), what)
{
}
Modified: trunk/boost/sync/locks/shared_lock.hpp
==============================================================================
--- trunk/boost/sync/locks/shared_lock.hpp Thu Sep 26 14:53:07 2013 (r85967)
+++ trunk/boost/sync/locks/shared_lock.hpp 2013-09-26 16:55:46 EDT (Thu, 26 Sep 2013) (r85968)
@@ -148,10 +148,10 @@
void lock()
{
if (!m_mutex)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost shared_lock has no mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::operation_not_permitted, "boost shared_lock has no mutex"));
if (m_is_locked)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::resource_deadlock_would_occur, "boost shared_lock already owns the mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::resource_deadlock_would_occur, "boost shared_lock already owns the mutex"));
m_mutex->lock_shared();
m_is_locked = true;
@@ -160,10 +160,10 @@
bool try_lock()
{
if (!m_mutex)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost shared_lock has no mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::operation_not_permitted, "boost shared_lock has no mutex"));
if (m_is_locked)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::resource_deadlock_would_occur, "boost shared_lock already owns the mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::resource_deadlock_would_occur, "boost shared_lock already owns the mutex"));
m_is_locked = m_mutex->try_lock_shared();
@@ -174,10 +174,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 shared_lock has no mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::operation_not_permitted, "boost shared_lock has no mutex"));
if (m_is_locked)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::resource_deadlock_would_occur, "boost shared_lock already owns the mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::resource_deadlock_would_occur, "boost shared_lock already owns the mutex"));
m_is_locked = m_mutex->timed_lock_shared(time);
@@ -188,10 +188,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 shared_lock has no mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::operation_not_permitted, "boost shared_lock has no mutex"));
if (m_is_locked)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::resource_deadlock_would_occur, "boost shared_lock already owns the mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::resource_deadlock_would_occur, "boost shared_lock already owns the mutex"));
m_is_locked = m_mutex->try_lock_shared_for(rel_time);
@@ -202,10 +202,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 shared_lock has no mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::operation_not_permitted, "boost shared_lock has no mutex"));
if (m_is_locked)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::resource_deadlock_would_occur, "boost shared_lock already owns the mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::resource_deadlock_would_occur, "boost shared_lock already owns the mutex"));
m_is_locked = m_mutex->try_lock_shared_until(abs_time);
@@ -215,10 +215,10 @@
void unlock()
{
if (!m_mutex)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost shared_lock has no mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::operation_not_permitted, "boost shared_lock has no mutex"));
if (!m_is_locked)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost shared_lock doesn't own the mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::operation_not_permitted, "boost shared_lock doesn't own the mutex"));
m_mutex->unlock_shared();
m_is_locked = false;
Modified: trunk/boost/sync/locks/unique_lock.hpp
==============================================================================
--- trunk/boost/sync/locks/unique_lock.hpp Thu Sep 26 14:53:07 2013 (r85967)
+++ trunk/boost/sync/locks/unique_lock.hpp 2013-09-26 16:55:46 EDT (Thu, 26 Sep 2013) (r85968)
@@ -186,10 +186,10 @@
void lock()
{
if (!m_mutex)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost unique_lock has no mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::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"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::resource_deadlock_would_occur, "boost unique_lock already owns the mutex"));
m_mutex->lock();
m_is_locked = true;
@@ -198,10 +198,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"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::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"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::resource_deadlock_would_occur, "boost unique_lock already owns the mutex"));
m_is_locked = m_mutex->try_lock();
@@ -212,10 +212,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"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::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"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::resource_deadlock_would_occur, "boost unique_lock already owns the mutex"));
m_is_locked = m_mutex->timed_lock(time);
@@ -226,10 +226,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"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::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"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::resource_deadlock_would_occur, "boost unique_lock already owns the mutex"));
m_is_locked = m_mutex->try_lock_for(rel_time);
@@ -240,10 +240,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"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::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"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::resource_deadlock_would_occur, "boost unique_lock already owns the mutex"));
m_is_locked = m_mutex->try_lock_until(abs_time);
@@ -253,10 +253,10 @@
void unlock()
{
if (!m_mutex)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost unique_lock has no mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::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"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::operation_not_permitted, "boost unique_lock doesn't own the mutex"));
m_mutex->unlock();
m_is_locked = false;
Modified: trunk/boost/sync/locks/upgrade_lock.hpp
==============================================================================
--- trunk/boost/sync/locks/upgrade_lock.hpp Thu Sep 26 14:53:07 2013 (r85967)
+++ trunk/boost/sync/locks/upgrade_lock.hpp 2013-09-26 16:55:46 EDT (Thu, 26 Sep 2013) (r85968)
@@ -168,10 +168,10 @@
void lock()
{
if (!m_mutex)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost upgrade_lock has no mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::operation_not_permitted, "boost upgrade_lock has no mutex"));
if (m_is_locked)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::resource_deadlock_would_occur, "boost upgrade_lock already owns the mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::resource_deadlock_would_occur, "boost upgrade_lock already owns the mutex"));
m_mutex->lock_upgrade();
m_is_locked = true;
@@ -180,10 +180,10 @@
bool try_lock()
{
if (!m_mutex)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost upgrade_lock has no mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::operation_not_permitted, "boost upgrade_lock has no mutex"));
if (m_is_locked)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::resource_deadlock_would_occur, "boost upgrade_lock already owns the mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::resource_deadlock_would_occur, "boost upgrade_lock already owns the mutex"));
m_is_locked = m_mutex->try_lock_upgrade();
@@ -194,10 +194,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 upgrade_lock has no mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::operation_not_permitted, "boost upgrade_lock has no mutex"));
if (m_is_locked)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::resource_deadlock_would_occur, "boost upgrade_lock already owns the mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::resource_deadlock_would_occur, "boost upgrade_lock already owns the mutex"));
m_is_locked = m_mutex->timed_lock_upgrade(time);
@@ -208,10 +208,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 upgrade_lock has no mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::operation_not_permitted, "boost upgrade_lock has no mutex"));
if (m_is_locked)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::resource_deadlock_would_occur, "boost upgrade_lock already owns the mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::resource_deadlock_would_occur, "boost upgrade_lock already owns the mutex"));
m_is_locked = m_mutex->try_lock_upgrade_for(rel_time);
@@ -222,10 +222,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 upgrade_lock has no mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::operation_not_permitted, "boost upgrade_lock has no mutex"));
if (m_is_locked)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::resource_deadlock_would_occur, "boost upgrade_lock already owns the mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::resource_deadlock_would_occur, "boost upgrade_lock already owns the mutex"));
m_is_locked = m_mutex->try_lock_upgrade_until(abs_time);
@@ -235,10 +235,10 @@
void unlock()
{
if (!m_mutex)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost upgrade_lock has no mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::operation_not_permitted, "boost upgrade_lock has no mutex"));
if (!m_is_locked)
- BOOST_THROW_EXCEPTION(lock_error(detail::system_namespace::errc::operation_not_permitted, "boost upgrade_lock doesn't own the mutex"));
+ BOOST_THROW_EXCEPTION(lock_error(detail::system_ns::errc::operation_not_permitted, "boost upgrade_lock doesn't own the mutex"));
m_mutex->unlock_upgrade();
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