summaryrefslogtreecommitdiff
path: root/cpp/include/IceUtil/Mutex.h
diff options
context:
space:
mode:
authorMatthew Newhook <matthew@zeroc.com>2001-12-31 14:27:22 +0000
committerMatthew Newhook <matthew@zeroc.com>2001-12-31 14:27:22 +0000
commitb51bb7c6bd2f50932219e96573939cef1f5c018c (patch)
tree45ca849effd41e325369ad2bf288476efba8bb52 /cpp/include/IceUtil/Mutex.h
parentinitial server support; align with stable_31 (diff)
downloadice-b51bb7c6bd2f50932219e96573939cef1f5c018c.tar.bz2
ice-b51bb7c6bd2f50932219e96573939cef1f5c018c.tar.xz
ice-b51bb7c6bd2f50932219e96573939cef1f5c018c.zip
Remove ConstLock, and friends.
Diffstat (limited to 'cpp/include/IceUtil/Mutex.h')
-rw-r--r--cpp/include/IceUtil/Mutex.h37
1 files changed, 17 insertions, 20 deletions
diff --git a/cpp/include/IceUtil/Mutex.h b/cpp/include/IceUtil/Mutex.h
index 5b4ffdaf3ee..0c43398b279 100644
--- a/cpp/include/IceUtil/Mutex.h
+++ b/cpp/include/IceUtil/Mutex.h
@@ -43,9 +43,6 @@ public:
typedef Lock<Mutex> Lock;
typedef TryLock<Mutex> TryLock;
- typedef ConstLock<Mutex> ConstLock;
- typedef ConstTryLock<Mutex> ConstTryLock;
-
Mutex();
~Mutex();
@@ -64,7 +61,7 @@ public:
//
// Return true if the mutex has been locked for the first time.
//
- bool lock();
+ bool lock() const;
//
// Throw LockedException in the case that the lock call would
@@ -72,13 +69,13 @@ public:
// thread). Returns true if the mutex has been locked for the
// first time.
//
- bool trylock();
+ bool trylock() const;
//
// Returns true if the mutex has been unlocked for the last time
// (false otherwise).
//
- bool unlock();
+ bool unlock() const;
private:
@@ -101,15 +98,15 @@ private:
};
#endif
- void unlock(LockState&);
- void lock(LockState&);
+ void unlock(LockState&) const;
+ void lock(LockState&) const;
friend class Cond;
#ifdef WIN32
- CRITICAL_SECTION _mutex;
+ mutable CRITICAL_SECTION _mutex;
#else
- pthread_mutex_t _mutex;
+ mutable pthread_mutex_t _mutex;
#endif
};
@@ -127,7 +124,7 @@ Mutex::~Mutex()
}
inline bool
-Mutex::lock()
+Mutex::lock() const
{
EnterCriticalSection(&_mutex);
//
@@ -139,7 +136,7 @@ Mutex::lock()
}
inline bool
-Mutex::trylock()
+Mutex::trylock() const
{
if (!TryEnterCriticalSection(&_mutex))
{
@@ -154,7 +151,7 @@ Mutex::trylock()
}
inline bool
-Mutex::unlock()
+Mutex::unlock() const
{
assert(_mutex.RecursionCount == 1);
LeaveCriticalSection(&_mutex);
@@ -162,13 +159,13 @@ Mutex::unlock()
}
inline void
-Mutex::unlock(LockState& state)
+Mutex::unlock(LockState& state) const
{
LeaveCriticalSection(&_mutex);
}
inline void
-Mutex::lock(LockState&)
+Mutex::lock(LockState&) const
{
EnterCriticalSection(&_mutex);
}
@@ -194,7 +191,7 @@ Mutex::~Mutex()
}
inline bool
-Mutex::lock()
+Mutex::lock() const
{
int rc = pthread_mutex_lock(&_mutex);
if (rc != 0)
@@ -205,7 +202,7 @@ Mutex::lock()
}
inline bool
-Mutex::trylock()
+Mutex::trylock() const
{
int rc = pthread_mutex_trylock(&_mutex);
if (rc != 0)
@@ -220,7 +217,7 @@ Mutex::trylock()
}
inline bool
-Mutex::unlock()
+Mutex::unlock() const
{
int rc = pthread_mutex_unlock(&_mutex);
if (rc != 0)
@@ -231,13 +228,13 @@ Mutex::unlock()
}
inline void
-Mutex::unlock(LockState& state)
+Mutex::unlock(LockState& state) const
{
state.mutex = &_mutex;
}
inline void
-Mutex::lock(LockState&)
+Mutex::lock(LockState&) const
{
}
#endif