blob: 44f8cb9d4aee92faae9ac742ae084ebfc5ae3368 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#pragma once
#include <windows.h>
class Mutex
{
public:
Mutex();
~Mutex();
void Lock();
void Unlock();
private:
HANDLE m_Handle;
};
class MutexLocker
{
public:
MutexLocker(Mutex& mutex)
: m(mutex)
{
m.Lock();
};
~MutexLocker()
{
m.Unlock();
}
operator bool() { return false; };
private:
void* operator new(size_t);
Mutex& m;
};
#define _lock(m) \
if(MutexLocker lock_##m = m){} else
|