Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-15 10:09:31

0001 //////////////////////////////////////////////////////////////////////////////
0002 //
0003 // (C) Copyright Vicente J. Botet Escriba 2008-2009,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/thread for documentation.
0008 //
0009 //////////////////////////////////////////////////////////////////////////////
0010 
0011 #ifndef BOOST_THREAD_NULL_MUTEX_HPP
0012 #define BOOST_THREAD_NULL_MUTEX_HPP
0013 
0014 #include <boost/thread/detail/config.hpp>
0015 #include <boost/thread/detail/delete.hpp>
0016 #include <boost/chrono/chrono.hpp>
0017 
0018 /// \file
0019 /// Describes null_mutex class
0020 
0021 namespace boost
0022 {
0023 
0024   /// Implements a mutex that simulates a mutex without doing any operation and
0025   /// simulates a successful operation.
0026   class null_mutex
0027   {
0028   public:
0029 
0030     BOOST_THREAD_NO_COPYABLE( null_mutex) /*< no copyable >*/
0031 
0032     null_mutex() {}
0033 
0034     /// Simulates a mutex lock() operation. Empty function.
0035     void lock()
0036     {
0037     }
0038 
0039     /// Simulates a mutex try_lock() operation.
0040     /// Equivalent to "return true;"
0041     bool try_lock()
0042     {
0043       return true;
0044     }
0045 
0046     /// Simulates a mutex unlock() operation.
0047     /// Empty function.
0048     void unlock()
0049     {
0050     }
0051 
0052 #ifdef BOOST_THREAD_USES_CHRONO
0053     /// Simulates a mutex try_lock_until() operation.
0054     /// Equivalent to "return true;"
0055     template <typename Clock, typename Duration>
0056     bool try_lock_until(chrono::time_point<Clock, Duration> const &)
0057     {
0058       return true;
0059     }
0060 
0061     /// Simulates a mutex try_lock_for() operation.
0062     /// Equivalent to "return true;"
0063     template <typename Rep, typename Period>
0064     bool try_lock_for(chrono::duration<Rep, Period> const &)
0065     {
0066       return true;
0067     }
0068 #endif
0069 
0070     /// Simulates a mutex lock_shared() operation.
0071     /// Empty function.
0072     void lock_shared()
0073     {
0074     }
0075 
0076     /// Simulates a mutex try_lock_shared() operation.
0077     /// Equivalent to "return true;"
0078     bool try_lock_shared()
0079     {
0080       return true;
0081     }
0082 
0083     /// Simulates a mutex unlock_shared() operation.
0084     /// Empty function.
0085     void unlock_shared()
0086     {
0087     }
0088 
0089     /// Simulates a mutex try_lock_shared_until() operation.
0090     /// Equivalent to "return true;"
0091     template <typename Clock, typename Duration>
0092     bool try_lock_shared_until(chrono::time_point<Clock, Duration> const &)
0093     {
0094       return true;
0095     }
0096     /// Simulates a mutex try_lock_shared_for() operation.
0097     /// Equivalent to "return true;"
0098     template <typename Rep, typename Period>
0099     bool try_lock_shared_for(chrono::duration<Rep, Period> const &)
0100     {
0101       return true;
0102     }
0103 
0104     /// Simulates a mutex lock_upgrade() operation.
0105     /// Empty function.
0106     void lock_upgrade()
0107     {
0108     }
0109 
0110     /// Simulates a mutex try_lock_upgrade() operation.
0111     /// Equivalent to "return true;"
0112     bool try_lock_upgrade()
0113     {
0114       return true;
0115     }
0116 
0117     /// Simulates a mutex unlock_upgrade() operation.
0118     /// Empty function.
0119     void unlock_upgrade()
0120     {
0121     }
0122 
0123     /// Simulates a mutex try_lock_upgrade_until() operation.
0124     /// Equivalent to "return true;"
0125     template <typename Clock, typename Duration>
0126     bool try_lock_upgrade_until(chrono::time_point<Clock, Duration> const &)
0127     {
0128       return true;
0129     }
0130 
0131     /// Simulates a mutex try_lock_upgrade_for() operation.
0132     /// Equivalent to "return true;"
0133     template <typename Rep, typename Period>
0134     bool try_lock_upgrade_for(chrono::duration<Rep, Period> const &)
0135     {
0136       return true;
0137     }
0138 
0139     /// Simulates a mutex try_unlock_shared_and_lock() operation.
0140     /// Equivalent to "return true;"
0141     bool try_unlock_shared_and_lock()
0142     {
0143       return true;
0144     }
0145 
0146 #ifdef BOOST_THREAD_USES_CHRONO
0147     /// Simulates a mutex try_unlock_shared_and_lock_until() operation.
0148     /// Equivalent to "return true;"
0149     template <typename Clock, typename Duration>
0150     bool try_unlock_shared_and_lock_until(chrono::time_point<Clock, Duration> const &)
0151     {
0152       return true;
0153     }
0154 
0155     /// Simulates a mutex try_unlock_shared_and_lock_for() operation.
0156     /// Equivalent to "return true;"
0157     template <typename Rep, typename Period>
0158     bool try_unlock_shared_and_lock_for(chrono::duration<Rep, Period> const &)
0159     {
0160       return true;
0161     }
0162 #endif
0163 
0164     /// Simulates unlock_and_lock_shared().
0165     /// Empty function.
0166     void unlock_and_lock_shared()
0167     {
0168     }
0169 
0170     /// Simulates a mutex try_unlock_shared_and_lock_upgrade() operation.
0171     /// Equivalent to "return true;"
0172     bool try_unlock_shared_and_lock_upgrade()
0173     {
0174       return true;
0175     }
0176 
0177 #ifdef BOOST_THREAD_USES_CHRONO
0178     /// Simulates a mutex try_unlock_shared_and_lock_upgrade_until() operation.
0179     /// Equivalent to "return true;"
0180     template <typename Clock, typename Duration>
0181     bool try_unlock_shared_and_lock_upgrade_until(chrono::time_point<Clock, Duration> const &)
0182     {
0183       return true;
0184     }
0185 
0186     /// Simulates a mutex try_unlock_shared_and_lock_upgrade_for() operation.
0187     /// Equivalent to "return true;"
0188     template <typename Rep, typename Period>
0189     bool try_unlock_shared_and_lock_upgrade_for(chrono::duration<Rep, Period> const &)
0190     {
0191       return true;
0192     }
0193 #endif
0194 
0195     /// Simulates unlock_and_lock_upgrade().
0196     /// Empty function.
0197     void unlock_and_lock_upgrade()
0198     {
0199     }
0200 
0201     /// Simulates unlock_upgrade_and_lock().
0202     /// Empty function.
0203     void unlock_upgrade_and_lock()
0204     {
0205     }
0206 
0207     /// Simulates a mutex try_unlock_upgrade_and_lock() operation.
0208     /// Equivalent to "return true;"
0209     bool try_unlock_upgrade_and_lock()
0210     {
0211       return true;
0212     }
0213 
0214 #ifdef BOOST_THREAD_USES_CHRONO
0215     /// Simulates a mutex try_unlock_upgrade_and_lock_until() operation.
0216     /// Equivalent to "return true;"
0217     template <typename Clock, typename Duration>
0218     bool try_unlock_upgrade_and_lock_until(chrono::time_point<Clock, Duration> const &)
0219     {
0220       return true;
0221     }
0222 
0223     /// Simulates a mutex try_unlock_upgrade_and_lock_for() operation.
0224     /// Equivalent to "return true;"
0225     template <typename Rep, typename Period>
0226     bool try_unlock_upgrade_and_lock_for(chrono::duration<Rep, Period> const &)
0227     {
0228       return true;
0229     }
0230 #endif
0231 
0232     /// Simulates unlock_upgrade_and_lock_shared().
0233     /// Empty function.
0234     void unlock_upgrade_and_lock_shared()
0235     {
0236     }
0237 
0238   };
0239 
0240 } //namespace boost {
0241 
0242 
0243 #endif