fix circular header dependency, by moving StackLock class to common/system.h (it ties closely into OSystem anyway)
svn-id: r13292
This commit is contained in:
parent
2314cdf036
commit
af80eef70e
4 changed files with 68 additions and 47 deletions
|
@ -83,3 +83,37 @@ bool OSystem::setGraphicsMode(const char *name) {
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
|
||||
namespace Common {
|
||||
|
||||
StackLock::StackLock(OSystem::MutexRef mutex, OSystem *syst, const char *mutexName)
|
||||
: _mutex(mutex), _syst(syst), _mutexName(mutexName) {
|
||||
if (syst == 0)
|
||||
_syst = g_system;
|
||||
lock();
|
||||
}
|
||||
|
||||
StackLock::~StackLock() {
|
||||
unlock();
|
||||
}
|
||||
|
||||
void StackLock::lock() {
|
||||
assert(_syst);
|
||||
if (_mutexName != NULL)
|
||||
debug(6, "Locking mutex %s", _mutexName);
|
||||
|
||||
_syst->lockMutex(_mutex);
|
||||
}
|
||||
|
||||
void StackLock::unlock() {
|
||||
assert(_syst);
|
||||
if (_mutexName != NULL)
|
||||
debug(6, "Unlocking mutex %s", _mutexName);
|
||||
|
||||
_syst->unlockMutex(_mutex);
|
||||
}
|
||||
|
||||
} // End of namespace Common
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue