diff options
Diffstat (limited to 'cpp/include/IceUtil/Lock.h')
-rw-r--r-- | cpp/include/IceUtil/Lock.h | 144 |
1 files changed, 72 insertions, 72 deletions
diff --git a/cpp/include/IceUtil/Lock.h b/cpp/include/IceUtil/Lock.h index 13f8d5fa2c7..c22d08d3f62 100644 --- a/cpp/include/IceUtil/Lock.h +++ b/cpp/include/IceUtil/Lock.h @@ -1,72 +1,72 @@ -// **********************************************************************
-//
-// Copyright (c) 2001
-// Mutable Realms, Inc.
-// Huntsville, AL, USA
-//
-// All Rights Reserved
-//
-// **********************************************************************
-
-#ifndef ICE_UTIL_LOCK_H
-#define ICE_UTIL_LOCK_H
-
-#include <IceUtil/Config.h>
-
-namespace IceUtil
-{
-
-//
-// Forward declarations.
-//
-class Cond;
-
-template <typename T>
-class Lock
-{
-public:
-
- Lock(const T& mutex) :
- _mutex(mutex)
- {
- _mutex.lock();
- }
-
- ~Lock()
- {
- _mutex.unlock();
- }
-
-private:
-
- const T& _mutex;
-
- friend class Cond;
-};
-
-template <typename T>
-class TryLock
-{
-public:
-
- TryLock(const T& mutex) :
- _mutex(mutex)
- {
- _mutex.trylock();
- }
-
- ~TryLock()
- {
- _mutex.unlock();
- }
-
-private:
-
- const T& _mutex;
-
- friend class Cond;
-};
-
-} // End namespace IceUtil
-
-#endif
+// ********************************************************************** +// +// Copyright (c) 2001 +// Mutable Realms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#ifndef ICE_UTIL_LOCK_H +#define ICE_UTIL_LOCK_H + +#include <IceUtil/Config.h> + +namespace IceUtil +{ + +// +// Forward declarations. +// +class Cond; + +template <typename T> +class Lock +{ +public: + + Lock(const T& mutex) : + _mutex(mutex) + { + _mutex.lock(); + } + + ~Lock() + { + _mutex.unlock(); + } + +private: + + const T& _mutex; + + friend class Cond; +}; + +template <typename T> +class TryLock +{ +public: + + TryLock(const T& mutex) : + _mutex(mutex) + { + _mutex.trylock(); + } + + ~TryLock() + { + _mutex.unlock(); + } + +private: + + const T& _mutex; + + friend class Cond; +}; + +} // End namespace IceUtil + +#endif |