Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-26 07:55:22

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