summaryrefslogtreecommitdiffstats
path: root/old/botan/src/mutex/win32_crit_section/mux_win32.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'old/botan/src/mutex/win32_crit_section/mux_win32.cpp')
-rw-r--r--old/botan/src/mutex/win32_crit_section/mux_win32.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/old/botan/src/mutex/win32_crit_section/mux_win32.cpp b/old/botan/src/mutex/win32_crit_section/mux_win32.cpp
new file mode 100644
index 0000000..2a96789
--- /dev/null
+++ b/old/botan/src/mutex/win32_crit_section/mux_win32.cpp
@@ -0,0 +1,34 @@
+/*
+* Win32 Mutex
+* (C) 2006 Luca Piccarreta
+* 2006-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#include <botan/mux_win32.h>
+#include <windows.h>
+
+namespace Botan {
+
+/*
+* Win32 Mutex Factory
+*/
+Mutex* Win32_Mutex_Factory::make()
+ {
+ class Win32_Mutex : public Mutex
+ {
+ public:
+ void lock() { EnterCriticalSection(&mutex); }
+ void unlock() { LeaveCriticalSection(&mutex); }
+
+ Win32_Mutex() { InitializeCriticalSection(&mutex); }
+ ~Win32_Mutex() { DeleteCriticalSection(&mutex); }
+ private:
+ CRITICAL_SECTION mutex;
+ };
+
+ return new Win32_Mutex();
+ }
+
+}