1 // **********************************************************************
3 // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
8 // **********************************************************************
10 #ifndef ICE_UTIL_ABSTRACT_MUTEX_H
11 #define ICE_UTIL_ABSTRACT_MUTEX_H
13 #include <IceUtil/Config.h>
14 #include <IceUtil/Lock.h>
23 typedef LockT
<AbstractMutex
> Lock
;
24 typedef TryLockT
<AbstractMutex
> TryLock
;
26 virtual ~AbstractMutex()
29 virtual void lock() const = 0;
30 virtual void unlock() const = 0;
31 virtual bool tryLock() const = 0;
35 class AbstractMutexI
: public AbstractMutex
, public T
39 #ifndef __BCPLUSPLUS__
40 typedef LockT
<AbstractMutexI
> Lock
;
41 typedef TryLockT
<AbstractMutexI
> TryLock
;
44 virtual void lock() const
49 virtual void unlock() const
54 virtual bool tryLock() const
59 virtual ~AbstractMutexI()
64 class AbstractMutexReadI
: public AbstractMutex
, public T
68 #ifndef __BCPLUSPLUS__
69 typedef LockT
<AbstractMutexReadI
> Lock
;
70 typedef TryLockT
<AbstractMutexReadI
> TryLock
;
73 virtual void lock() const
78 virtual void unlock() const
83 virtual bool tryLock() const
85 return T::tryReadLock();
88 virtual ~AbstractMutexReadI()
93 class AbstractMutexWriteI
: public AbstractMutex
, public T
97 #ifndef __BCPLUSPLUS__
98 typedef LockT
<AbstractMutexWriteI
> Lock
;
99 typedef TryLockT
<AbstractMutexWriteI
> TryLock
;
102 virtual void lock() const
107 virtual void unlock() const
112 virtual bool tryLock() const
114 return T::tryWriteLock();
117 virtual ~AbstractMutexWriteI()