diff options
Diffstat (limited to 'src/utils/mutex/win32_crit_section')
-rw-r--r-- | src/utils/mutex/win32_crit_section/info.txt | 16 | ||||
-rw-r--r-- | src/utils/mutex/win32_crit_section/mux_win32.cpp | 32 | ||||
-rw-r--r-- | src/utils/mutex/win32_crit_section/mux_win32.h | 24 |
3 files changed, 72 insertions, 0 deletions
diff --git a/src/utils/mutex/win32_crit_section/info.txt b/src/utils/mutex/win32_crit_section/info.txt new file mode 100644 index 000000000..d235ff73c --- /dev/null +++ b/src/utils/mutex/win32_crit_section/info.txt @@ -0,0 +1,16 @@ +realname "Win32 Mutex" + +define MUTEX_WIN32 +modset win32 + +load_on auto + +<add> +mux_win32.cpp +mux_win32.h +</add> + +<os> +cygwin +windows +</os> diff --git a/src/utils/mutex/win32_crit_section/mux_win32.cpp b/src/utils/mutex/win32_crit_section/mux_win32.cpp new file mode 100644 index 000000000..622a707fa --- /dev/null +++ b/src/utils/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(); + } + +} diff --git a/src/utils/mutex/win32_crit_section/mux_win32.h b/src/utils/mutex/win32_crit_section/mux_win32.h new file mode 100644 index 000000000..20b245967 --- /dev/null +++ b/src/utils/mutex/win32_crit_section/mux_win32.h @@ -0,0 +1,24 @@ +/************************************************* +* Win32 Mutex Header File * +* (C) 2006 Luca Piccarreta * +* 2006-2007 Jack Lloyd * +*************************************************/ + +#ifndef BOTAN_MUTEX_WIN32_H__ +#define BOTAN_MUTEX_WIN32_H__ + +#include <botan/mutex.h> + +namespace Botan { + +/************************************************* +* Win32 Mutex Factory * +*************************************************/ +class Win32_Mutex_Factory : public Mutex_Factory + { + public: + Mutex* make(); + }; +} + +#endif |