[Scummvm-cvs-logs] CVS: scummvm/common util.h,1.21,1.22 util.cpp,1.15,1.16

Max Horn fingolfin at users.sourceforge.net
Sat Jul 5 08:29:06 CEST 2003


Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1:/tmp/cvs-serv23395/common

Modified Files:
	util.h util.cpp 
Log Message:
fixed stack lock at startup

Index: util.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/util.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- util.h	5 Jul 2003 15:19:11 -0000	1.21
+++ util.h	5 Jul 2003 15:28:27 -0000	1.22
@@ -80,10 +80,11 @@
  */
 class StackLock {
 	OSystem::MutexRef _mutex;
+	OSystem *_syst;
 	void lock();
 	void unlock();
 public:
-	StackLock(OSystem::MutexRef mutex);
+	StackLock(OSystem::MutexRef mutex, OSystem *syst = 0);
 	~StackLock();
 };
 

Index: util.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/util.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- util.cpp	5 Jul 2003 15:19:11 -0000	1.15
+++ util.cpp	5 Jul 2003 15:28:28 -0000	1.16
@@ -166,7 +166,10 @@
 	return getRandomNumber(max - min) + min;
 }
 
-StackLock::StackLock(OSystem::MutexRef mutex) : _mutex(mutex) {
+StackLock::StackLock(OSystem::MutexRef mutex, OSystem *syst)
+	: _mutex(mutex), _syst(syst) {
+	if (syst == 0)
+		_syst = g_system;
 	lock();
 }
 
@@ -175,12 +178,12 @@
 }
 
 void StackLock::lock() {
-	assert(g_system);
+	assert(_syst);
 	g_system->lock_mutex(_mutex);
 }
 
 void StackLock::unlock() {
-	assert(g_system);
+	assert(_syst);
 	g_system->unlock_mutex(_mutex);
 }
 





More information about the Scummvm-git-logs mailing list