Botan: src/mutex/win32_crit_section/mux_win32.cpp Source File

Botan 1.10.17

mux_win32.cpp
Go to the documentation of this file.
1 /*
2 * Win32 Mutex
3 * (C) 2006 Luca Piccarreta
4 * 2006-2007 Jack Lloyd
5 *
6 * Distributed under the terms of the Botan license
7 */
8
9 #include <botan/internal/mux_win32.h>
10 #include <windows.h>
11
12 namespace Botan {
13
14 /*
15 * Win32 Mutex Factory
16 */
17 Mutex* Win32_Mutex_Factory::make()
18 {
19 class Win32_Mutex : public Mutex
20 {
21 public:
22 void lock() { EnterCriticalSection(&mutex); }
23 void unlock() { LeaveCriticalSection(&mutex); }
24
25 Win32_Mutex() { InitializeCriticalSection(&mutex); }
26 ~Win32_Mutex() { DeleteCriticalSection(&mutex); }
27 private:
28 CRITICAL_SECTION mutex;
29 };
30
31 return new Win32_Mutex();
32 }
33
34 }
Botan::Win32_Mutex_Factory::make
Mutex * make()
Definition: mux_win32.cpp:17
Botan
Definition: algo_base.h:14
Botan::Mutex
Definition: mutex.h:18