summaryrefslogtreecommitdiff
path: root/plugins/Quotes/src/LightMutex.h
blob: e8c7363ba15f5b8345453ad999d30cd40461e4d2 (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
#ifndef __a33da2bb_d4fe4aa7_aaf5_f9f8c3156ce6_LightMutex_h__
#define __a33da2bb_d4fe4aa7_aaf5_f9f8c3156ce6_LightMutex_h__

class CLightMutex
{
public:
	CLightMutex();
	~CLightMutex();

	void Lock();
	void Unlock();

private:
	CRITICAL_SECTION m_cs;
};

template<class TObject> class CGuard
{
public:
	CGuard(TObject& obj) : m_obj(obj)
	{
		m_obj.Lock();
	}

	~CGuard()
	{
		m_obj.Unlock();
	}

private:
	TObject& m_obj;
};

#endif //__a33da2bb_d4fe4aa7_aaf5_f9f8c3156ce6_LightMutex_h__