Chris@16: ////////////////////////////////////////////////////////////////////////////// Chris@16: // Chris@16: // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost Chris@16: // Software License, Version 1.0. (See accompanying file Chris@16: // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: // See http://www.boost.org/libs/interprocess for documentation. Chris@16: // Chris@16: ////////////////////////////////////////////////////////////////////////////// Chris@16: Chris@16: #ifndef BOOST_INTERPROCESS_NULL_MUTEX_HPP Chris@16: #define BOOST_INTERPROCESS_NULL_MUTEX_HPP Chris@16: Chris@101: #ifndef BOOST_CONFIG_HPP Chris@101: # include Chris@101: #endif Chris@101: # Chris@101: #if defined(BOOST_HAS_PRAGMA_ONCE) Chris@16: # pragma once Chris@16: #endif Chris@16: Chris@16: #include Chris@16: #include Chris@16: Chris@16: Chris@16: //!\file Chris@16: //!Describes null_mutex classes Chris@16: Chris@16: namespace boost { Chris@16: Chris@101: #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) Chris@101: Chris@16: namespace posix_time Chris@16: { class ptime; } Chris@16: Chris@101: #endif //#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) Chris@101: Chris@16: namespace interprocess { Chris@16: Chris@16: //!Implements a mutex that simulates a mutex without doing any operation and Chris@16: //!simulates a successful operation. Chris@16: class null_mutex Chris@16: { Chris@101: #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) Chris@16: null_mutex(const null_mutex&); Chris@16: null_mutex &operator= (const null_mutex&); Chris@101: #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED Chris@16: public: Chris@16: Chris@16: //!Constructor. Chris@16: //!Empty. Chris@16: null_mutex(){} Chris@16: Chris@16: //!Destructor. Chris@16: //!Empty. Chris@16: ~null_mutex(){} Chris@16: Chris@16: //!Simulates a mutex lock() operation. Empty function. Chris@16: void lock(){} Chris@16: Chris@16: //!Simulates a mutex try_lock() operation. Chris@16: //!Equivalent to "return true;" Chris@16: bool try_lock() Chris@16: { return true; } Chris@16: Chris@16: //!Simulates a mutex timed_lock() operation. Chris@16: //!Equivalent to "return true;" Chris@16: bool timed_lock(const boost::posix_time::ptime &) Chris@16: { return true; } Chris@16: Chris@16: //!Simulates a mutex unlock() operation. Chris@16: //!Empty function. Chris@16: void unlock(){} Chris@16: Chris@16: //!Simulates a mutex lock_sharable() operation. Chris@16: //!Empty function. Chris@16: void lock_sharable(){} Chris@16: Chris@16: //!Simulates a mutex try_lock_sharable() operation. Chris@16: //!Equivalent to "return true;" Chris@16: bool try_lock_sharable() Chris@16: { return true; } Chris@16: Chris@16: //!Simulates a mutex timed_lock_sharable() operation. Chris@16: //!Equivalent to "return true;" Chris@16: bool timed_lock_sharable(const boost::posix_time::ptime &) Chris@16: { return true; } Chris@16: Chris@16: //!Simulates a mutex unlock_sharable() operation. Chris@16: //!Empty function. Chris@16: void unlock_sharable(){} Chris@16: Chris@16: //!Simulates a mutex lock_upgradable() operation. Chris@16: //!Empty function. Chris@16: void lock_upgradable(){} Chris@16: Chris@16: //!Simulates a mutex try_lock_upgradable() operation. Chris@16: //!Equivalent to "return true;" Chris@16: bool try_lock_upgradable() Chris@16: { return true; } Chris@16: Chris@16: //!Simulates a mutex timed_lock_upgradable() operation. Chris@16: //!Equivalent to "return true;" Chris@16: bool timed_lock_upgradable(const boost::posix_time::ptime &) Chris@16: { return true; } Chris@16: Chris@16: //!Simulates a mutex unlock_upgradable() operation. Chris@16: //!Empty function. Chris@16: void unlock_upgradable(){} Chris@16: Chris@16: //!Simulates unlock_and_lock_upgradable(). Chris@16: //!Empty function. Chris@16: void unlock_and_lock_upgradable(){} Chris@16: Chris@16: //!Simulates unlock_and_lock_sharable(). Chris@16: //!Empty function. Chris@16: void unlock_and_lock_sharable(){} Chris@16: Chris@16: //!Simulates unlock_upgradable_and_lock_sharable(). Chris@16: //!Empty function. Chris@16: void unlock_upgradable_and_lock_sharable(){} Chris@16: Chris@16: //Promotions Chris@16: Chris@16: //!Simulates unlock_upgradable_and_lock(). Chris@16: //!Empty function. Chris@16: void unlock_upgradable_and_lock(){} Chris@16: Chris@16: //!Simulates try_unlock_upgradable_and_lock(). Chris@16: //!Equivalent to "return true;" Chris@16: bool try_unlock_upgradable_and_lock() Chris@16: { return true; } Chris@16: Chris@16: //!Simulates timed_unlock_upgradable_and_lock(). Chris@16: //!Equivalent to "return true;" Chris@16: bool timed_unlock_upgradable_and_lock(const boost::posix_time::ptime &) Chris@16: { return true; } Chris@16: Chris@16: //!Simulates try_unlock_sharable_and_lock(). Chris@16: //!Equivalent to "return true;" Chris@16: bool try_unlock_sharable_and_lock() Chris@16: { return true; } Chris@16: Chris@16: //!Simulates try_unlock_sharable_and_lock_upgradable(). Chris@16: //!Equivalent to "return true;" Chris@16: bool try_unlock_sharable_and_lock_upgradable() Chris@16: { return true; } Chris@16: }; Chris@16: Chris@16: } //namespace interprocess { Chris@16: } //namespace boost { Chris@16: Chris@16: #include Chris@16: Chris@16: #endif //BOOST_INTERPROCESS_NULL_MUTEX_HPP