diff options
author | lloyd <[email protected]> | 2009-04-01 15:43:27 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-04-01 15:43:27 +0000 |
commit | 99e8c1a20700631103ec20386f8080eeee4df588 (patch) | |
tree | bc3ecc536cb98a39c2707dc8eba08e3a648a5c45 /Attic/mutex/win32_crit_section | |
parent | 855b569d25b5810213ae7e52c04df4e5e0cf8d46 (diff) |
Remove the mutex classes in favor of C++0x's std::mutex and std::lock_guard
Diffstat (limited to 'Attic/mutex/win32_crit_section')
-rw-r--r-- | Attic/mutex/win32_crit_section/info.txt | 17 | ||||
-rw-r--r-- | Attic/mutex/win32_crit_section/mux_win32.cpp | 34 | ||||
-rw-r--r-- | Attic/mutex/win32_crit_section/mux_win32.h | 26 |
3 files changed, 77 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..a2d339c3b --- /dev/null +++ b/Attic/mutex/win32_crit_section/info.txt @@ -0,0 +1,17 @@ +realname "Win32 Mutex" + +define MUTEX_WIN32 +modset win32 + +load_on auto + +<add> +mux_win32.cpp +mux_win32.h +</add> + +<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..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(); + } + +} 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..a91850e71 --- /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/mutex.h> + +namespace Botan { + +/* +* Win32 Mutex Factory +*/ +class BOTAN_DLL Win32_Mutex_Factory : public Mutex_Factory + { + public: + Mutex* make(); + }; +} + +#endif |