From b438a3c6d08893ca77a1d18baef1b02e955eccf8 Mon Sep 17 00:00:00 2001 From: lloyd Date: Fri, 3 Jul 2009 04:47:49 +0000 Subject: Move mutex directory back to the Attic --- Attic/mutex/mutex.h | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Attic/mutex/mutex.h (limited to 'Attic/mutex/mutex.h') diff --git a/Attic/mutex/mutex.h b/Attic/mutex/mutex.h new file mode 100644 index 000000000..a04ff83c9 --- /dev/null +++ b/Attic/mutex/mutex.h @@ -0,0 +1,56 @@ +/* +* Mutex +* (C) 1999-2007 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_MUTEX_H__ +#define BOTAN_MUTEX_H__ + +#include + +namespace Botan { + +/* +* Mutex Base Class +*/ +class BOTAN_DLL Mutex + { + public: + virtual void lock() = 0; + virtual void unlock() = 0; + virtual ~Mutex() {} + }; + +/* +* Mutex Factory +*/ +class BOTAN_DLL Mutex_Factory + { + public: + virtual Mutex* make() = 0; + virtual ~Mutex_Factory() {} + }; + +/* +* Mutex Holding Class +*/ +class BOTAN_DLL Mutex_Holder + { + public: + Mutex_Holder(Mutex* m) : mux(m) + { + if(!mux) + throw Invalid_Argument("Mutex_Holder: Argument was NULL"); + mux->lock(); + } + + ~Mutex_Holder() { mux->unlock(); } + private: + Mutex* mux; + }; + +} + +#endif -- cgit v1.2.3