drivers/can_ixxat_win32/autoreleasecs.h
changeset 252 b0dd37421d28
child 255 7b9f36dbfe5f
equal deleted inserted replaced
251:cab66ef3e68e 252:b0dd37421d28
       
     1 // Critical Section Autorelease
       
     2 // Tochinski Leonid, Chatten Associates, Inc. 2007
       
     3 #pragma once
       
     4 
       
     5 class AutoReleaseCS
       
     6    {
       
     7    public:
       
     8       AutoReleaseCS(CRITICAL_SECTION& cs) : m_cs(cs)
       
     9          {
       
    10          ::EnterCriticalSection(&m_cs);
       
    11          }
       
    12       ~AutoReleaseCS()
       
    13          {
       
    14          ::LeaveCriticalSection(&m_cs);
       
    15          }
       
    16       CRITICAL_SECTION& m_cs;
       
    17    };