aboutsummaryrefslogtreecommitdiffstats
path: root/Attic/mutex/win32_crit_section
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-02-25 23:07:38 +0000
committerlloyd <[email protected]>2010-02-25 23:07:38 +0000
commit5fec937bd0c72858d6cf2f09b58b219294c7d5cc (patch)
tree811714c0663199782b07b8f20a328eeeeff9e768 /Attic/mutex/win32_crit_section
parent08647db8877585a783797c8db22dc76233b200f0 (diff)
parent3e95540b28f3d828c4578381c318545f6ad49589 (diff)
propagate from branch 'net.randombit.botan' (head c1db52e38b60afbc6549af5222d6e10b1b9730dd)
to branch 'net.randombit.botan.c++0x' (head e56dfbfe6bffbd5b4e52b115549d885c5fd04586)
Diffstat (limited to 'Attic/mutex/win32_crit_section')
-rw-r--r--Attic/mutex/win32_crit_section/info.txt15
-rw-r--r--Attic/mutex/win32_crit_section/mux_win32.cpp34
-rw-r--r--Attic/mutex/win32_crit_section/mux_win32.h26
3 files changed, 75 insertions, 0 deletions
diff --git a/Attic/mutex/win32_crit_section/info.txt b/Attic/mutex/win32_crit_section/info.txt
new file mode 100644
index 000000000..d90b8b64b
--- /dev/null
+++ b/Attic/mutex/win32_crit_section/info.txt
@@ -0,0 +1,15 @@
+define MUTEX_WIN32
+
+<source>
+mux_win32.cpp
+</source>
+
+<header:internal>
+mux_win32.h
+</header:internal>
+
+<os>
+cygwin
+windows
+mingw
+</os>
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..fa6051798
--- /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/internal/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();
+ }
+
+}
diff --git a/Attic/mutex/win32_crit_section/mux_win32.h b/Attic/mutex/win32_crit_section/mux_win32.h
new file mode 100644
index 000000000..4bbf6a540
--- /dev/null
+++ b/Attic/mutex/win32_crit_section/mux_win32.h
@@ -0,0 +1,26 @@
+/*
+* Win32 Mutex
+* (C) 2006 Luca Piccarreta
+* 2006-2007 Jack Lloyd
+*
+* Distributed under the terms of the Botan license
+*/
+
+#ifndef BOTAN_MUTEX_WIN32_H__
+#define BOTAN_MUTEX_WIN32_H__
+
+#include <botan/internal/mutex.h>
+
+namespace Botan {
+
+/*
+* Win32 Mutex Factory
+*/
+class Win32_Mutex_Factory : public Mutex_Factory
+ {
+ public:
+ Mutex* make();
+ };
+}
+
+#endif