[Scummvm-cvs-logs] CVS: scummvm sdl.cpp,1.123,1.124 x11.cpp,1.29,1.30 system.h,1.22,1.23

Lionel Ulmer bbrox at users.sourceforge.net
Tue Jun 4 11:19:07 CEST 2002


Update of /cvsroot/scummvm/scummvm
In directory usw-pr-cvs1:/tmp/cvs-serv1240

Modified Files:
	sdl.cpp x11.cpp system.h 
Log Message:
Sorry for the mess.... Here is the mutex code :-)



Index: sdl.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sdl.cpp,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -d -r1.123 -r1.124
--- sdl.cpp	18 May 2002 14:53:18 -0000	1.123
+++ sdl.cpp	4 Jun 2002 18:18:43 -0000	1.124
@@ -99,6 +99,12 @@
 	// Add a callback timer
 	void set_timer(int timer, int (*callback)(int));
 
+	// Mutex handling
+	void *create_mutex(void);
+	void lock_mutex(void *mutex);
+	void unlock_mutex(void *mutex);
+	void delete_mutex(void *mutex);
+
 	static OSystem *create(int gfx_mode, bool full_screen);
 
 private:
@@ -1147,6 +1153,23 @@
 	SDL_Surface *sdl_surf = SDL_CreateRGBSurfaceFrom(icon, 32, 32, 32, 32 * 4, 0xFF0000, 0x00FF00, 0x0000FF, 0xFF000000);
 	SDL_WM_SetIcon(sdl_surf, (unsigned char *) mask);
 }
+
+void *OSystem_SDL::create_mutex(void) {
+	return (void *) SDL_CreateMutex();
+}
+
+void OSystem_SDL::lock_mutex(void *mutex) {
+	SDL_mutexP((SDL_mutex *) mutex);
+}
+
+void OSystem_SDL::unlock_mutex(void *mutex) {
+	SDL_mutexV((SDL_mutex *) mutex);
+}
+
+void OSystem_SDL::delete_mutex(void *mutex) {
+	SDL_DestroyMutex((SDL_mutex *) mutex);
+}
+
 
 #ifdef USE_NULL_DRIVER
 

Index: x11.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/x11.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- x11.cpp	20 May 2002 21:19:53 -0000	1.29
+++ x11.cpp	4 Jun 2002 18:18:44 -0000	1.30
@@ -116,6 +116,12 @@
 	// Add a callback timer
 	void set_timer(int timer, int (*callback)(int));
 
+	// Mutex handling
+	void *create_mutex(void);
+	void lock_mutex(void *mutex);
+	void unlock_mutex(void *mutex);
+	void delete_mutex(void *mutex);
+
 	static OSystem *create(int gfx_mode, bool full_screen);
 
 private:
@@ -935,4 +941,23 @@
 	} else {
 		_timer_active = false;
 	}
+}
+
+void *OSystem_X11::create_mutex(void) {
+	pthread_mutex_t *mutex = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t));
+	pthread_mutex_init(mutex, NULL);
+	return (void *) mutex;
+}
+
+void OSystem_X11::lock_mutex(void *mutex) {
+	pthread_mutex_lock((pthread_mutex_t *) mutex);
+}
+
+void OSystem_X11::unlock_mutex(void *mutex) {
+	pthread_mutex_unlock((pthread_mutex_t *) mutex);
+}
+
+void OSystem_X11::delete_mutex(void *mutex) {
+	pthread_mutex_destroy((pthread_mutex_t *) mutex);
+	free(mutex);
 }

Index: system.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/system.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- system.h	2 Jun 2002 20:28:09 -0000	1.22
+++ system.h	4 Jun 2002 18:18:44 -0000	1.23
@@ -142,6 +142,12 @@
 	// Add a new callback timer
 	virtual void set_timer(int timer, int (*callback)(int)) = 0;
 
+	// Mutex handling
+	virtual void *create_mutex(void) = 0;
+	virtual void lock_mutex(void *mutex) = 0;
+	virtual void unlock_mutex(void *mutex) = 0;
+	virtual void delete_mutex(void *mutex) = 0;
+
 	// Quit
 	virtual void quit() = 0;
 };





More information about the Scummvm-git-logs mailing list