aboutsummaryrefslogtreecommitdiffstats
path: root/src/mutex/win32_crit_section/mux_win32.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-11 20:58:37 +0000
committerlloyd <[email protected]>2008-11-11 20:58:37 +0000
commit8879a51da7c3b93e27439122cea5d5aa81ae38c3 (patch)
treeb1faa753266d4a762fc38252df35a2435b757b92 /src/mutex/win32_crit_section/mux_win32.cpp
parent6eff33ae263109ccbbeb32bd0ffb25c77140cc45 (diff)
Move utils/{timer,mutex} to toplevel
Diffstat (limited to 'src/mutex/win32_crit_section/mux_win32.cpp')
-rw-r--r--src/mutex/win32_crit_section/mux_win32.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/mutex/win32_crit_section/mux_win32.cpp b/src/mutex/win32_crit_section/mux_win32.cpp
new file mode 100644
index 000000000..622a707fa
--- /dev/null
+++ b/src/mutex/win32_crit_section/mux_win32.cpp
@@ -0,0 +1,32 @@
+/*************************************************
+* Win32 Mutex Source File *
+* (C) 2006 Luca Piccarreta *
+* 2006-2007 Jack Lloyd *
+*************************************************/
+
+#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();
+ }
+
+}