diff options
Diffstat (limited to 'boost/interprocess/sync/shm/named_upgradable_mutex.hpp')
-rw-r--r-- | boost/interprocess/sync/shm/named_upgradable_mutex.hpp | 53 |
1 files changed, 17 insertions, 36 deletions
diff --git a/boost/interprocess/sync/shm/named_upgradable_mutex.hpp b/boost/interprocess/sync/shm/named_upgradable_mutex.hpp index 0975a6ed2b..4c397927fb 100644 --- a/boost/interprocess/sync/shm/named_upgradable_mutex.hpp +++ b/boost/interprocess/sync/shm/named_upgradable_mutex.hpp @@ -1,6 +1,6 @@ ////////////////////////////////////////////////////////////////////////////// // -// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // @@ -11,7 +11,7 @@ #ifndef BOOST_INTERPROCESS_NAMED_UPGRADABLE_MUTEX_HPP #define BOOST_INTERPROCESS_NAMED_UPGRADABLE_MUTEX_HPP -#if (defined _MSC_VER) && (_MSC_VER >= 1200) +#if defined(_MSC_VER) # pragma once #endif @@ -32,9 +32,9 @@ namespace boost { namespace interprocess { -/// @cond +#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) namespace ipcdetail{ class interprocess_tester; } -/// @endcond +#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED class named_condition; @@ -43,13 +43,13 @@ class named_condition; //!each process should have it's own named upgradable mutex. class named_upgradable_mutex { - /// @cond + #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) //Non-copyable named_upgradable_mutex(); named_upgradable_mutex(const named_upgradable_mutex &); named_upgradable_mutex &operator=(const named_upgradable_mutex &); friend class named_condition; - /// @endcond + #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED public: //!Creates a global upgradable mutex with a name. @@ -221,7 +221,7 @@ class named_upgradable_mutex //!Returns false on error. Never throws. static bool remove(const char *name); - /// @cond + #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) private: friend class ipcdetail::interprocess_tester; void dont_close_on_destruction(); @@ -229,12 +229,13 @@ class named_upgradable_mutex interprocess_upgradable_mutex *mutex() const { return static_cast<interprocess_upgradable_mutex*>(m_shmem.get_user_address()); } - ipcdetail::managed_open_or_create_impl<shared_memory_object> m_shmem; + typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0, true, false> open_create_impl_t; + open_create_impl_t m_shmem; typedef ipcdetail::named_creation_functor<interprocess_upgradable_mutex> construct_func_t; - /// @endcond + #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED }; -/// @cond +#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) inline named_upgradable_mutex::~named_upgradable_mutex() {} @@ -244,8 +245,7 @@ inline named_upgradable_mutex::named_upgradable_mutex : m_shmem (create_only ,name ,sizeof(interprocess_upgradable_mutex) + - ipcdetail::managed_open_or_create_impl<shared_memory_object>:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(ipcdetail::DoCreate) @@ -257,8 +257,7 @@ inline named_upgradable_mutex::named_upgradable_mutex : m_shmem (open_or_create ,name ,sizeof(interprocess_upgradable_mutex) + - ipcdetail::managed_open_or_create_impl<shared_memory_object>:: - ManagedOpenOrCreateUserOffset + open_create_impl_t::ManagedOpenOrCreateUserOffset ,read_write ,0 ,construct_func_t(ipcdetail::DoOpenOrCreate) @@ -288,13 +287,7 @@ inline bool named_upgradable_mutex::try_lock() inline bool named_upgradable_mutex::timed_lock (const boost::posix_time::ptime &abs_time) -{ - if(abs_time == boost::posix_time::pos_infin){ - this->lock(); - return true; - } - return this->mutex()->timed_lock(abs_time); -} +{ return this->mutex()->timed_lock(abs_time); } inline void named_upgradable_mutex::lock_upgradable() { this->mutex()->lock_upgradable(); } @@ -307,13 +300,7 @@ inline bool named_upgradable_mutex::try_lock_upgradable() inline bool named_upgradable_mutex::timed_lock_upgradable (const boost::posix_time::ptime &abs_time) -{ - if(abs_time == boost::posix_time::pos_infin){ - this->lock_upgradable(); - return true; - } - return this->mutex()->timed_lock_upgradable(abs_time); -} +{ return this->mutex()->timed_lock_upgradable(abs_time); } inline void named_upgradable_mutex::lock_sharable() { this->mutex()->lock_sharable(); } @@ -326,13 +313,7 @@ inline bool named_upgradable_mutex::try_lock_sharable() inline bool named_upgradable_mutex::timed_lock_sharable (const boost::posix_time::ptime &abs_time) -{ - if(abs_time == boost::posix_time::pos_infin){ - this->lock_sharable(); - return true; - } - return this->mutex()->timed_lock_sharable(abs_time); -} +{ return this->mutex()->timed_lock_sharable(abs_time); } inline void named_upgradable_mutex::unlock_and_lock_upgradable() { this->mutex()->unlock_and_lock_upgradable(); } @@ -362,7 +343,7 @@ inline bool named_upgradable_mutex::try_unlock_sharable_and_lock_upgradable() inline bool named_upgradable_mutex::remove(const char *name) { return shared_memory_object::remove(name); } -/// @endcond +#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED } //namespace interprocess { } //namespace boost { |