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