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