diff options
Diffstat (limited to 'common')
| -rw-r--r-- | common/util.cpp | 10 | ||||
| -rw-r--r-- | common/util.h | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/common/util.cpp b/common/util.cpp index 962f3d9afd..601894883d 100644 --- a/common/util.cpp +++ b/common/util.cpp @@ -103,8 +103,8 @@ uint RandomSource::getRandomNumberRng(uint min, uint max) { #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 @@ StackLock::~StackLock() { 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); } diff --git a/common/util.h b/common/util.h index 7b91104523..e05cc12c71 100644 --- a/common/util.h +++ b/common/util.h @@ -81,10 +81,12 @@ public: 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(); }; |
