[Scummvm-cvs-logs] CVS: scummvm/common util.cpp,1.37,1.38 util.h,1.40,1.41

James Brown ender at users.sourceforge.net
Sat Feb 14 01:03:02 CET 2004


Update of /cvsroot/scummvm/scummvm/common
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv329/common

Modified Files:
	util.cpp util.h 
Log Message:
Add mutex tracking to make it easier to debug imuse deadlocks


Index: util.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/util.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- util.cpp	10 Feb 2004 13:24:12 -0000	1.37
+++ util.cpp	14 Feb 2004 08:56:26 -0000	1.38
@@ -103,8 +103,8 @@
 #pragma mark -
 
 
-StackLock::StackLock(OSystem::MutexRef mutex, OSystem *syst)
-	: _mutex(mutex), _syst(syst) {
+StackLock::StackLock(OSystem::MutexRef mutex, OSystem *syst, char *mutexName)
+	: _mutex(mutex), _syst(syst), _mutexName(mutexName) {
 	if (syst == 0)
 		_syst = g_system;
 	lock();
@@ -116,11 +116,17 @@
 
 void StackLock::lock() {
 	assert(_syst);
+	if (_mutexName != NULL)
+		debug(5, "Locking mutex %s", _mutexName);
+	
 	_syst->lock_mutex(_mutex);
 }
 
 void StackLock::unlock() {
 	assert(_syst);
+	if (_mutexName != NULL)
+		debug(5, "Unlocking mutex %s", _mutexName);
+
 	_syst->unlock_mutex(_mutex);
 }
 

Index: util.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/common/util.h,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- util.h	10 Feb 2004 13:24:12 -0000	1.40
+++ util.h	14 Feb 2004 08:56:26 -0000	1.41
@@ -81,10 +81,12 @@
 class StackLock {
 	OSystem::MutexRef _mutex;
 	OSystem *_syst;
+	char *_mutexName;
+
 	void lock();
 	void unlock();
 public:
-	StackLock(OSystem::MutexRef mutex, OSystem *syst = 0);
+	StackLock(OSystem::MutexRef mutex, OSystem *syst = 0, char *mutexName = NULL);
 	~StackLock();
 };
 





More information about the Scummvm-git-logs mailing list