Rice GLES2 (from mupen64plus-ae) plugin. Compile but doesn't works well on the OpenPa...
[mupen64plus-pandora.git] / source / gles2rice / src / CritSect.h
CommitLineData
292f9317 1/*
2Copyright (C) 2003 Rice1964
3
4This program is free software; you can redistribute it and/or
5modify it under the terms of the GNU General Public License
6as published by the Free Software Foundation; either version 2
7of the License, or (at your option) any later version.
8
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
16Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18*/
19
20#if !defined(CRITSECT_H)
21#define CRITSECT_H
22
23#include <SDL.h>
24
25class CCritSect
26{
27public:
28 CCritSect()
29 {
30 cs = SDL_CreateMutex();
31 locked = 0;
32 }
33
34 ~CCritSect()
35 {
36 SDL_DestroyMutex(cs);
37 }
38
39 void Lock()
40 {
41 SDL_LockMutex(cs);
42 locked = 1;
43 }
44
45 void Unlock()
46 {
47 locked = 0;
48 SDL_UnlockMutex(cs);
49 }
50
51 bool IsLocked()
52 {
53 return (locked != 0);
54 }
55
56protected:
57 SDL_mutex *cs;
58 int locked;
59};
60
61#endif // !defined(CRITSECT_H)
62