drivers/can_ixxat_win32/autoreleasecs.h
changeset 252 b0dd37421d28
child 255 7b9f36dbfe5f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/drivers/can_ixxat_win32/autoreleasecs.h	Wed Aug 08 01:43:02 2007 +0200
@@ -0,0 +1,17 @@
+// Critical Section Autorelease
+// Tochinski Leonid, Chatten Associates, Inc. 2007
+#pragma once
+
+class AutoReleaseCS
+   {
+   public:
+      AutoReleaseCS(CRITICAL_SECTION& cs) : m_cs(cs)
+         {
+         ::EnterCriticalSection(&m_cs);
+         }
+      ~AutoReleaseCS()
+         {
+         ::LeaveCriticalSection(&m_cs);
+         }
+      CRITICAL_SECTION& m_cs;
+   };