Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:38:33

0001 //////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
0004 // Software License, Version 1.0. (See accompanying file
0005 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 // See http://www.boost.org/libs/interprocess for documentation.
0008 //
0009 //////////////////////////////////////////////////////////////////////////////
0010 
0011 #ifndef BOOST_INTERPROCESS_NULL_MUTEX_HPP
0012 #define BOOST_INTERPROCESS_NULL_MUTEX_HPP
0013 
0014 #ifndef BOOST_CONFIG_HPP
0015 #  include <boost/config.hpp>
0016 #endif
0017 #
0018 #if defined(BOOST_HAS_PRAGMA_ONCE)
0019 #  pragma once
0020 #endif
0021 
0022 #include <boost/interprocess/detail/config_begin.hpp>
0023 #include <boost/interprocess/detail/workaround.hpp>
0024 
0025 
0026 //!\file
0027 //!Describes null_mutex classes
0028 
0029 namespace boost {
0030 namespace interprocess {
0031 
0032 //!Implements a mutex that simulates a mutex without doing any operation and
0033 //!simulates a successful operation.
0034 class null_mutex
0035 {
0036    #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
0037    null_mutex(const null_mutex&);
0038    null_mutex &operator= (const null_mutex&);
0039    #endif   //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
0040    public:
0041 
0042    //!Constructor.
0043    //!Empty.
0044    null_mutex() BOOST_NOEXCEPT {}
0045 
0046    //!Destructor.
0047    //!Empty.
0048    ~null_mutex(){}
0049 
0050    //!Simulates a mutex lock() operation. Empty function.
0051    void lock(){}
0052 
0053    //!Simulates a mutex try_lock() operation.
0054    //!Equivalent to "return true;"
0055    bool try_lock()
0056    {  return true;   }
0057 
0058    //!Simulates a mutex timed_lock() operation.
0059    //!Equivalent to "return true;"
0060    template<class TimePoint>
0061    bool timed_lock(const TimePoint &)
0062    {  return true;   }
0063 
0064    //!Same as `timed_lock`, but this function is modeled after the
0065    //!standard library interface.
0066    template<class TimePoint>
0067    bool try_lock_until(const TimePoint &)
0068    {  return true;  }
0069 
0070    //!Same as `timed_lock`, but this function is modeled after the
0071    //!standard library interface.
0072    template<class Duration> 
0073    bool try_lock_for(const Duration &)
0074    {  return true; }
0075 
0076    //!Simulates a mutex unlock() operation.
0077    //!Empty function.
0078    void unlock(){}
0079 
0080    //!Simulates a mutex lock_sharable() operation.
0081    //!Empty function.
0082    void lock_sharable(){}
0083 
0084    //!Same as `lock_sharable` but with a std-compatible interface
0085    //! 
0086    void lock_shared()
0087    {  this->lock_sharable();  }
0088 
0089    //!Simulates a mutex try_lock_sharable() operation.
0090    //!Equivalent to "return true;"
0091    bool try_lock_sharable()
0092    {  return true;   }
0093 
0094    //!Same as `try_lock_sharable` but with a std-compatible interface
0095    //! 
0096    bool try_lock_shared()
0097    {  return this->try_lock_sharable();  }
0098 
0099    //!Simulates a mutex timed_lock_sharable() operation.
0100    //!Equivalent to "return true;"
0101    template<class TimePoint>
0102    bool timed_lock_sharable(const TimePoint &)
0103    {  return true;   }
0104 
0105    //!Simulates a mutex unlock_sharable() operation.
0106    //!Empty function.
0107    void unlock_sharable(){}
0108 
0109    //!Same as `unlock_sharable` but with a std-compatible interface
0110    //! 
0111    void unlock_shared()
0112    {  this->unlock_sharable();  }
0113 
0114    //!Simulates a mutex lock_upgradable() operation.
0115    //!Empty function.
0116    void lock_upgradable(){}
0117 
0118    //!Simulates a mutex try_lock_upgradable() operation.
0119    //!Equivalent to "return true;"
0120    bool try_lock_upgradable()
0121    {  return true;   }
0122 
0123    //!Simulates a mutex timed_lock_upgradable() operation.
0124    //!Equivalent to "return true;"
0125    template<class TimePoint>
0126    bool timed_lock_upgradable(const TimePoint &)
0127    {  return true;   }
0128 
0129    //!Simulates a mutex unlock_upgradable() operation.
0130    //!Empty function.
0131    void unlock_upgradable(){}
0132 
0133    //!Simulates unlock_and_lock_upgradable().
0134    //!Empty function.
0135    void unlock_and_lock_upgradable(){}
0136 
0137    //!Simulates unlock_and_lock_sharable().
0138    //!Empty function.
0139    void unlock_and_lock_sharable(){}
0140 
0141    //!Simulates unlock_upgradable_and_lock_sharable().
0142    //!Empty function.
0143    void unlock_upgradable_and_lock_sharable(){}
0144 
0145    //Promotions
0146 
0147    //!Simulates unlock_upgradable_and_lock().
0148    //!Empty function.
0149    void unlock_upgradable_and_lock(){}
0150 
0151    //!Simulates try_unlock_upgradable_and_lock().
0152    //!Equivalent to "return true;"
0153    bool try_unlock_upgradable_and_lock()
0154    {  return true;   }
0155 
0156    //!Simulates timed_unlock_upgradable_and_lock().
0157    //!Equivalent to "return true;"
0158    template<class TimePoint>
0159    bool timed_unlock_upgradable_and_lock(const TimePoint &)
0160    {  return true;   }
0161 
0162    //!Simulates try_unlock_sharable_and_lock().
0163    //!Equivalent to "return true;"
0164    bool try_unlock_sharable_and_lock()
0165    {  return true;   }
0166 
0167    //!Simulates try_unlock_sharable_and_lock_upgradable().
0168    //!Equivalent to "return true;"
0169    bool try_unlock_sharable_and_lock_upgradable()
0170    {  return true;   }
0171 };
0172 
0173 }  //namespace interprocess {
0174 }  //namespace boost {
0175 
0176 #include <boost/interprocess/detail/config_end.hpp>
0177 
0178 #endif   //BOOST_INTERPROCESS_NULL_MUTEX_HPP