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
12namespace Botan {
13
14/*
15* Win32 Mutex Factory
16*/
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}