LoggedMutex now works on Linux
This commit is contained in:
parent
9e5308bbb4
commit
d0e006c481
1 changed files with 8 additions and 16 deletions
|
@ -1,7 +1,7 @@
|
||||||
//
|
//
|
||||||
// C++ Implementation: Thread
|
// C++ Implementation: Thread
|
||||||
//
|
//
|
||||||
// Description:
|
// Description:
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// Author: Micke Prag <micke.prag@telldus.se>, (C) 2009
|
// Author: Micke Prag <micke.prag@telldus.se>, (C) 2009
|
||||||
|
@ -45,7 +45,7 @@ Mutex::~Mutex() {
|
||||||
#endif
|
#endif
|
||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mutex::lock() {
|
void Mutex::lock() {
|
||||||
#ifdef _WINDOWS
|
#ifdef _WINDOWS
|
||||||
WaitForSingleObject(d->mutex, INFINITE);
|
WaitForSingleObject(d->mutex, INFINITE);
|
||||||
|
@ -62,29 +62,21 @@ void Mutex::unlock() {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LoggedMutex::lock() {
|
void LoggedMutex::lock() {
|
||||||
#ifdef _WINDOWS
|
debuglog(0, "Locking");
|
||||||
debuglog(GetCurrentThreadId(), "Locking");
|
|
||||||
#endif
|
|
||||||
Mutex::lock();
|
Mutex::lock();
|
||||||
#ifdef _WINDOWS
|
debuglog(0, "Locked");
|
||||||
debuglog(GetCurrentThreadId(), "Locked");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoggedMutex::unlock() {
|
void LoggedMutex::unlock() {
|
||||||
#ifdef _WINDOWS
|
debuglog(0, "Unlocking");
|
||||||
debuglog(GetCurrentThreadId(), "Unlocking");
|
|
||||||
#endif
|
|
||||||
Mutex::unlock();
|
Mutex::unlock();
|
||||||
#ifdef _WINDOWS
|
debuglog(0, "Unlocked");
|
||||||
debuglog(GetCurrentThreadId(), "Unlocked");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MutexLocker::MutexLocker(Mutex *m)
|
MutexLocker::MutexLocker(Mutex *m)
|
||||||
:mutex(m)
|
:mutex(m)
|
||||||
{
|
{
|
||||||
mutex->lock();
|
mutex->lock();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue