summaryrefslogtreecommitdiff
path: root/protocols/Quotes/src/LightMutex.h
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/Quotes/src/LightMutex.h')
-rw-r--r--protocols/Quotes/src/LightMutex.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/protocols/Quotes/src/LightMutex.h b/protocols/Quotes/src/LightMutex.h
new file mode 100644
index 0000000000..e8c7363ba1
--- /dev/null
+++ b/protocols/Quotes/src/LightMutex.h
@@ -0,0 +1,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__