[Scummvm-cvs-logs] CVS: scummvm/backends/sdl sdl-common.cpp,1.66,1.67 sdl-common.h,1.29,1.30
Max Horn
fingolfin at users.sourceforge.net
Sat Jul 5 08:18:14 CEST 2003
Update of /cvsroot/scummvm/scummvm/backends/sdl
In directory sc8-pr-cvs1:/tmp/cvs-serv22014/sdl
Modified Files:
sdl-common.cpp sdl-common.h
Log Message:
updated backends to use type MutexRef
Index: sdl-common.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- sdl-common.cpp 3 Jul 2003 21:45:04 -0000 1.66
+++ sdl-common.cpp 5 Jul 2003 15:17:46 -0000 1.67
@@ -23,6 +23,7 @@
#include "sound/mididrv.h"
#include "common/scaler.h"
#include "common/engine.h" // Only #included for error() and warning()
+#include "common/util.h"
#include "scummvm.xpm"
@@ -63,7 +64,7 @@
error("Could not initialize SDL: %s.\n", SDL_GetError());
}
- _graphicsMutex = SDL_CreateMutex();
+ _graphicsMutex = create_mutex();
SDL_ShowCursor(SDL_DISABLE);
@@ -113,7 +114,7 @@
free(_dirty_checksums);
free(_currentPalette);
free(_mouseBackup);
- SDL_DestroyMutex(_graphicsMutex);
+ delete_mutex(_graphicsMutex);
SDL_ShowCursor(SDL_ENABLE);
#ifdef MACOSX
@@ -1192,19 +1193,19 @@
SDL_FreeSurface(sdl_surf);
}
-void *OSystem_SDL_Common::create_mutex(void) {
- return (void *) SDL_CreateMutex();
+OSystem::MutexRef OSystem_SDL_Common::create_mutex(void) {
+ return (MutexRef) SDL_CreateMutex();
}
-void OSystem_SDL_Common::lock_mutex(void *mutex) {
+void OSystem_SDL_Common::lock_mutex(MutexRef mutex) {
SDL_mutexP((SDL_mutex *) mutex);
}
-void OSystem_SDL_Common::unlock_mutex(void *mutex) {
+void OSystem_SDL_Common::unlock_mutex(MutexRef mutex) {
SDL_mutexV((SDL_mutex *) mutex);
}
-void OSystem_SDL_Common::delete_mutex(void *mutex) {
+void OSystem_SDL_Common::delete_mutex(MutexRef mutex) {
SDL_DestroyMutex((SDL_mutex *) mutex);
}
Index: sdl-common.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/backends/sdl/sdl-common.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- sdl-common.h 2 Jul 2003 15:08:46 -0000 1.29
+++ sdl-common.h 5 Jul 2003 15:17:46 -0000 1.30
@@ -105,10 +105,10 @@
void set_timer(int timer, int (*callback)(int));
// Mutex handling
- void *create_mutex();
- void lock_mutex(void *mutex);
- void unlock_mutex(void *mutex);
- void delete_mutex(void *mutex);
+ MutexRef create_mutex();
+ void lock_mutex(MutexRef mutex);
+ void unlock_mutex(MutexRef mutex);
+ void delete_mutex(MutexRef mutex);
// Overlay
virtual void show_overlay();
@@ -208,7 +208,7 @@
// Mutex that prevents multiple threads interferring with each other
// when accessing the screen.
- SDL_mutex *_graphicsMutex;
+ MutexRef _graphicsMutex;
void add_dirty_rgn_auto(const byte *buf);
@@ -228,16 +228,5 @@
void kbd_mouse();
void init_joystick() { _joystick = SDL_JoystickOpen(0); }
};
-
-// Auxillary class to (un)lock a mutex on the stack
-class StackLock {
- SDL_mutex *_mutex;
-public:
- StackLock(SDL_mutex *mutex) : _mutex(mutex) { lock(); }
- ~StackLock() { unlock(); }
- void lock() { SDL_mutexP(_mutex); }
- void unlock() { SDL_mutexV(_mutex); }
-};
-
#endif
More information about the Scummvm-git-logs
mailing list