drivers/can_ixxat_win32/autoreleasecs.h
changeset 255 7b9f36dbfe5f
parent 252 b0dd37421d28
equal deleted inserted replaced
254:f2b0acb54e65 255:7b9f36dbfe5f
       
     1 /*
       
     2 This file is part of CanFestival, a library implementing CanOpen Stack.
       
     3 
       
     4 CanFestival Copyright (C): Edouard TISSERANT and Francis DUPIN
       
     5 CanFestival Win32 port Copyright (C) 2007 Leonid Tochinski, ChattenAssociates, Inc.
       
     6 
       
     7 See COPYING file for copyrights details.
       
     8 
       
     9 This library is free software; you can redistribute it and/or
       
    10 modify it under the terms of the GNU Lesser General Public
       
    11 License as published by the Free Software Foundation; either
       
    12 version 2.1 of the License, or (at your option) any later version.
       
    13 
       
    14 This library is distributed in the hope that it will be useful,
       
    15 but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    17 Lesser General Public License for more details.
       
    18 
       
    19 You should have received a copy of the GNU Lesser General Public
       
    20 License along with this library; if not, write to the Free Software
       
    21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    22 */
       
    23 
     1 // Critical Section Autorelease
    24 // Critical Section Autorelease
     2 // Tochinski Leonid, Chatten Associates, Inc. 2007
    25 #ifndef __autoreleasecs_h__
     3 #pragma once
    26 #define __autoreleasecs_h__
     4 
    27 
     5 class AutoReleaseCS
    28 class AutoReleaseCS
     6    {
    29    {
     7    public:
    30    public:
     8       AutoReleaseCS(CRITICAL_SECTION& cs) : m_cs(cs)
    31       AutoReleaseCS(CRITICAL_SECTION& cs) : m_cs(cs)
    13          {
    36          {
    14          ::LeaveCriticalSection(&m_cs);
    37          ::LeaveCriticalSection(&m_cs);
    15          }
    38          }
    16       CRITICAL_SECTION& m_cs;
    39       CRITICAL_SECTION& m_cs;
    17    };
    40    };
       
    41  #endif // __autoreleasecs_h__