aboutsummaryrefslogtreecommitdiffstats
path: root/src/mutex.cpp
diff options
context:
space:
mode:
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()