PageRenderTime 67ms CodeModel.GetById 59ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/boost/interprocess/sync/null_mutex.hpp

http://hadesmem.googlecode.com/
C++ Header | 147 lines | 53 code | 35 blank | 59 comment | 1 complexity | 47ed3e3d4b4bf8d35966eae54e9f18aa MD5 | raw file
  1//////////////////////////////////////////////////////////////////////////////
  2//
  3// (C) Copyright Ion Gaztanaga 2005-2009. Distributed under the Boost
  4// Software License, Version 1.0. (See accompanying file
  5// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  6//
  7// See http://www.boost.org/libs/interprocess for documentation.
  8//
  9//////////////////////////////////////////////////////////////////////////////
 10
 11#ifndef BOOST_INTERPROCESS_NULL_MUTEX_HPP
 12#define BOOST_INTERPROCESS_NULL_MUTEX_HPP
 13
 14#if (defined _MSC_VER) && (_MSC_VER >= 1200)
 15#  pragma once
 16#endif
 17
 18#include <boost/interprocess/detail/config_begin.hpp>
 19#include <boost/interprocess/detail/workaround.hpp>
 20
 21
 22//!\file
 23//!Describes null_mutex classes
 24
 25namespace boost {
 26
 27namespace posix_time
 28{  class ptime;   }
 29
 30namespace interprocess {
 31
 32//!Implements a mutex that simulates a mutex without doing any operation and
 33//!simulates a successful operation.
 34class null_mutex
 35{
 36   /// @cond
 37   null_mutex(const null_mutex&);
 38   null_mutex &operator= (const null_mutex&);
 39   /// @endcond
 40   public:
 41
 42   //!Constructor.
 43   //!Empty.
 44   null_mutex(){}
 45
 46   //!Destructor.
 47   //!Empty.
 48   ~null_mutex(){}
 49
 50   //!Simulates a mutex lock() operation. Empty function.
 51   void lock(){}
 52
 53   //!Simulates a mutex try_lock() operation.
 54   //!Equivalent to "return true;"
 55   bool try_lock()
 56   {  return true;   }
 57
 58   //!Simulates a mutex timed_lock() operation.
 59   //!Equivalent to "return true;"
 60   bool timed_lock(const boost::posix_time::ptime &)
 61   {  return true;   }
 62
 63   //!Simulates a mutex unlock() operation.
 64   //!Empty function.
 65   void unlock(){}
 66
 67   //!Simulates a mutex lock_sharable() operation.
 68   //!Empty function.
 69   void lock_sharable(){}
 70
 71   //!Simulates a mutex try_lock_sharable() operation.
 72   //!Equivalent to "return true;"
 73   bool try_lock_sharable()
 74   {  return true;   }
 75
 76   //!Simulates a mutex timed_lock_sharable() operation.
 77   //!Equivalent to "return true;"
 78   bool timed_lock_sharable(const boost::posix_time::ptime &)
 79   {  return true;   }
 80
 81   //!Simulates a mutex unlock_sharable() operation.
 82   //!Empty function.
 83   void unlock_sharable(){}
 84
 85   //!Simulates a mutex lock_upgradable() operation.
 86   //!Empty function.
 87   void lock_upgradable(){}
 88
 89   //!Simulates a mutex try_lock_upgradable() operation.
 90   //!Equivalent to "return true;"
 91   bool try_lock_upgradable()
 92   {  return true;   }
 93
 94   //!Simulates a mutex timed_lock_upgradable() operation.
 95   //!Equivalent to "return true;"
 96   bool timed_lock_upgradable(const boost::posix_time::ptime &)
 97   {  return true;   }
 98
 99   //!Simulates a mutex unlock_upgradable() operation.
100   //!Empty function.
101   void unlock_upgradable(){}
102
103   //!Simulates unlock_and_lock_upgradable().
104   //!Empty function.
105   void unlock_and_lock_upgradable(){}
106
107   //!Simulates unlock_and_lock_sharable().
108   //!Empty function.
109   void unlock_and_lock_sharable(){}
110
111   //!Simulates unlock_upgradable_and_lock_sharable().
112   //!Empty function.
113   void unlock_upgradable_and_lock_sharable(){}
114
115   //Promotions
116
117   //!Simulates unlock_upgradable_and_lock().
118   //!Empty function.
119   void unlock_upgradable_and_lock(){}
120
121   //!Simulates try_unlock_upgradable_and_lock().
122   //!Equivalent to "return true;"
123   bool try_unlock_upgradable_and_lock()
124   {  return true;   }
125
126   //!Simulates timed_unlock_upgradable_and_lock().
127   //!Equivalent to "return true;"
128   bool timed_unlock_upgradable_and_lock(const boost::posix_time::ptime &)
129   {  return true;   }
130
131   //!Simulates try_unlock_sharable_and_lock().
132   //!Equivalent to "return true;"
133   bool try_unlock_sharable_and_lock()
134   {  return true;   }
135
136   //!Simulates try_unlock_sharable_and_lock_upgradable().
137   //!Equivalent to "return true;"
138   bool try_unlock_sharable_and_lock_upgradable()
139   {  return true;   }
140};
141
142}  //namespace interprocess {
143}  //namespace boost {
144
145#include <boost/interprocess/detail/config_end.hpp>
146
147#endif   //BOOST_INTERPROCESS_NULL_MUTEX_HPP