leonid@255: /* leonid@255: This file is part of CanFestival, a library implementing CanOpen Stack. leonid@255: leonid@255: CanFestival Copyright (C): Edouard TISSERANT and Francis DUPIN leonid@255: CanFestival Win32 port Copyright (C) 2007 Leonid Tochinski, ChattenAssociates, Inc. leonid@255: leonid@255: See COPYING file for copyrights details. leonid@255: leonid@255: This library is free software; you can redistribute it and/or leonid@255: modify it under the terms of the GNU Lesser General Public leonid@255: License as published by the Free Software Foundation; either leonid@255: version 2.1 of the License, or (at your option) any later version. leonid@255: leonid@255: This library is distributed in the hope that it will be useful, leonid@255: but WITHOUT ANY WARRANTY; without even the implied warranty of leonid@255: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU leonid@255: Lesser General Public License for more details. leonid@255: leonid@255: You should have received a copy of the GNU Lesser General Public leonid@255: License along with this library; if not, write to the Free Software leonid@255: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA leonid@255: */ leonid@255: leonid@252: // Critical Section Autorelease leonid@255: #ifndef __autoreleasecs_h__ leonid@255: #define __autoreleasecs_h__ leonid@252: leonid@252: class AutoReleaseCS leonid@252: { leonid@252: public: leonid@252: AutoReleaseCS(CRITICAL_SECTION& cs) : m_cs(cs) leonid@252: { leonid@252: ::EnterCriticalSection(&m_cs); leonid@252: } leonid@252: ~AutoReleaseCS() leonid@252: { leonid@252: ::LeaveCriticalSection(&m_cs); leonid@252: } leonid@252: CRITICAL_SECTION& m_cs; leonid@252: }; leonid@255: #endif // __autoreleasecs_h__