aboutsummaryrefslogtreecommitdiffstats
path: root/Attic/mutex/win32_crit_section/mux_win32.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-11-02 12:12:40 +0000
committerlloyd <[email protected]>2009-11-02 12:12:40 +0000
commitb8658279904708d0690e473fb85942d5da23d2fc (patch)
tree65528378bd0089287ca0927a13a6e0a012f7bc78 /Attic/mutex/win32_crit_section/mux_win32.cpp
parent6b617a55bd02bcc4fdb6f76af92e0cb65fd838a2 (diff)
parent92f31b22dfe2aa1b2bde84cbaf4ce7365fa4ec68 (diff)
propagate from branch 'net.randombit.botan' (head 2773c2310e8c0a51975987a2dd6c5824c8d43882)
to branch 'net.randombit.botan.c++0x' (head f13cf5d7e89706c882604299b508f356c20aae3a)
Diffstat (limited to 'Attic/mutex/win32_crit_section/mux_win32.cpp')
-rw-r--r--Attic/mutex/win32_crit_section/mux_win32.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/Attic/mutex/win32_crit_section/mux_win32.cpp b/Attic/mutex/win32_crit_section/mux_win32.cpp
new file mode 100644
index 000000000..2a967892b
--- /dev/null
+++ b/Attic/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();
+ }
+
+}