1 //////////////////////////////////////////////////////////////////////
3 // CriticalSection.h: interface for the CCriticalSection class.
5 //////////////////////////////////////////////////////////////////////
6 #ifndef _CRITICAL_SECTION_H_
7 #define _CRITICAL_SECTION_H_
11 #endif // _MSC_VER > 1000
13 #include "PlatformDefs.h"
14 #include "linux/XSyncUtils.h"
15 #include "XCriticalSection.h"
17 #include "win32/XCriticalSection.h"
21 * Copyright (C) 2005-2008 Team XBMC
24 * This Program is free software; you can redistribute it and/or modify
25 * it under the terms of the GNU General Public License as published by
26 * the Free Software Foundation; either version 2, or (at your option)
29 * This Program is distributed in the hope that it will be useful,
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32 * GNU General Public License for more details.
34 * You should have received a copy of the GNU General Public License
35 * along with XBMC; see the file COPYING. If not, write to
36 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
37 * http://www.gnu.org/copyleft/gpl.html
41 class CCriticalSection
44 // Constructor/destructor.
46 virtual ~CCriticalSection();
48 XCriticalSection
& getCriticalSection() { return m_criticalSection
; }
51 XCriticalSection m_criticalSection
;
53 //don't allow copying a CCriticalSection
54 CCriticalSection(const CCriticalSection
& section
) {}
55 CCriticalSection
& operator=(const CCriticalSection
& section
) {return *this;}
58 // The CCritical section overloads.
59 void InitializeCriticalSection(CCriticalSection
* section
);
60 void DeleteCriticalSection(CCriticalSection
* section
);
61 BOOL
OwningCriticalSection(CCriticalSection
* section
);
62 DWORD
ExitCriticalSection(CCriticalSection
* section
);
63 void RestoreCriticalSection(CCriticalSection
* section
, DWORD count
);
64 void EnterCriticalSection(CCriticalSection
* section
);
65 void LeaveCriticalSection(CCriticalSection
* section
);
67 // And a few special ones.
68 void EnterCriticalSection(CCriticalSection
& section
);
69 void LeaveCriticalSection(CCriticalSection
& section
);
70 BOOL
OwningCriticalSection(CCriticalSection
& section
);
71 DWORD
ExitCriticalSection(CCriticalSection
& section
);
72 void RestoreCriticalSection(CCriticalSection
& section
, DWORD count
);