diff options
author | lloyd <[email protected]> | 2009-07-03 04:47:49 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-07-03 04:47:49 +0000 |
commit | b438a3c6d08893ca77a1d18baef1b02e955eccf8 (patch) | |
tree | 129c4605183b6440e8d673824e194c44f55af3db /Attic/mutex/mutex.h | |
parent | e0555387e440c708294a3593c90d3066ae4a0a55 (diff) |
Move mutex directory back to the Attic
Diffstat (limited to 'Attic/mutex/mutex.h')
-rw-r--r-- | Attic/mutex/mutex.h | 56 |
1 files changed, 56 insertions, 0 deletions
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 <botan/exceptn.h> + +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 |