Path: blob/master/libmupen64plus/mupen64plus-video-rice/src/CritSect.h
2 views
/*1Copyright (C) 2003 Rice196423This program is free software; you can redistribute it and/or4modify it under the terms of the GNU General Public License5as published by the Free Software Foundation; either version 26of the License, or (at your option) any later version.78This program is distributed in the hope that it will be useful,9but WITHOUT ANY WARRANTY; without even the implied warranty of10MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11GNU General Public License for more details.1213You should have received a copy of the GNU General Public License14along with this program; if not, write to the Free Software15Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.1617*/1819#if !defined(CRITSECT_H)20#define CRITSECT_H2122#include <SDL.h>2324class CCritSect25{26public:27CCritSect()28{29cs = SDL_CreateMutex();30locked = 0;31}3233~CCritSect()34{35SDL_DestroyMutex(cs);36}3738void Lock()39{40SDL_LockMutex(cs);41locked = 1;42}4344void Unlock()45{46locked = 0;47SDL_UnlockMutex(cs);48}4950bool IsLocked()51{52return (locked != 0);53}5455protected:56SDL_mutex *cs;57int locked;58};5960#endif // !defined(CRITSECT_H)61626364