diff options
author | lloyd <[email protected]> | 2006-05-18 18:33:19 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-05-18 18:33:19 +0000 |
commit | a2c99d3270eb73ef2db5704fc54356c6b75096f8 (patch) | |
tree | ad3d6c4fcc8dd0f403f8105598943616246fe172 /modules/mux_win32 |
Initial checkin1.5.6
Diffstat (limited to 'modules/mux_win32')
-rw-r--r-- | modules/mux_win32/modinfo.txt | 11 | ||||
-rw-r--r-- | modules/mux_win32/mux_win32.cpp | 39 | ||||
-rw-r--r-- | modules/mux_win32/mux_win32.h | 23 |
3 files changed, 73 insertions, 0 deletions
diff --git a/modules/mux_win32/modinfo.txt b/modules/mux_win32/modinfo.txt new file mode 100644 index 000000000..ed8d688b3 --- /dev/null +++ b/modules/mux_win32/modinfo.txt @@ -0,0 +1,11 @@ +realname "Win32 Mutex" + +define MUTEX_WIN32 + +add_file mux_win32.cpp +add_file mux_win32.h + +<os> +cygwin +windows +</os> diff --git a/modules/mux_win32/mux_win32.cpp b/modules/mux_win32/mux_win32.cpp new file mode 100644 index 000000000..400aea183 --- /dev/null +++ b/modules/mux_win32/mux_win32.cpp @@ -0,0 +1,39 @@ +/************************************************* +* Win32 Mutex Source File * +* (C) 1999-2006 The Botan Project * +*************************************************/ + +#include <botan/mux_win32.h> +#include <botan/exceptn.h> +#include <windows.h> + +namespace Botan { + +namespace { + +/************************************************* +* Win32 Mutex * +*************************************************/ +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; + }; + +} + +/************************************************* +* Win32 Mutex Factory * +*************************************************/ +Mutex* Win32_Mutex_Factory::make() + { + return new Win32_Mutex(); + } + +} diff --git a/modules/mux_win32/mux_win32.h b/modules/mux_win32/mux_win32.h new file mode 100644 index 000000000..7ff1276aa --- /dev/null +++ b/modules/mux_win32/mux_win32.h @@ -0,0 +1,23 @@ +/************************************************* +* Win32 Mutex Header File * +* (C) 1999-2006 The Botan Project * +*************************************************/ + +#ifndef BOTAN_EXT_MUTEX_WIN32_H__ +#define BOTAN_EXT_MUTEX_WIN32_H__ + +#include <botan/mutex.h> + +namespace Botan { + +/************************************************* +* Win32 Mutex Factory * +*************************************************/ +class Win32_Mutex_Factory : public Mutex_Factory + { + public: + Mutex* make(); + }; +} + +#endif |