aboutsummaryrefslogtreecommitdiffstats
path: root/src/mutex.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-06-25 15:23:19 +0000
committerlloyd <[email protected]>2006-06-25 15:23:19 +0000
commit7a259add43ce9ad6ea30fcbb77ac7bca932db211 (patch)
treec1d4857694ddd3bc4709c54337cd8fa76669e6c5 /src/mutex.cpp
parenta495fd2e01430a74833d667b6fec0a2cc4b23be5 (diff)
Support named mutexes outside of the global library state.
Alter the AEP engine to use one in favor of a static Mutex pointer. Fix a stupid typo in an exception message.
Diffstat (limited to 'src/mutex.cpp')
-rw-r--r--src/mutex.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mutex.cpp b/src/mutex.cpp
index 5514922b2..a6d18a44c 100644
--- a/src/mutex.cpp
+++ b/src/mutex.cpp
@@ -4,6 +4,7 @@
*************************************************/
#include <botan/mutex.h>
+#include <botan/libstate.h>
namespace Botan {
@@ -26,6 +27,23 @@ Mutex_Holder::~Mutex_Holder()
}
/*************************************************
+* Named_Mutex_Holder Constructor *
+*************************************************/
+Named_Mutex_Holder::Named_Mutex_Holder(const std::string& name) :
+ mutex_name(name)
+ {
+ global_state().get_named_mutex(mutex_name)->lock();
+ }
+
+/*************************************************
+* Named_Mutex_Holder Destructor *
+*************************************************/
+Named_Mutex_Holder::~Named_Mutex_Holder()
+ {
+ global_state().get_named_mutex(mutex_name)->unlock();
+ }
+
+/*************************************************
* Default Mutex Factory *
*************************************************/
Mutex* Mutex_Factory::make()