diff --git a/stepmania/src/RageThreads.cpp b/stepmania/src/RageThreads.cpp index 0775923fd4..140881fda1 100644 --- a/stepmania/src/RageThreads.cpp +++ b/stepmania/src/RageThreads.cpp @@ -86,13 +86,6 @@ LockMutex::~LockMutex() { if(locked) mutex.Unlock(); - - if(file) - { - float dur = RageTimer::GetTimeSinceStart() - locked_at; - if(dur > 0.015) - LOG->Trace(ssprintf("Lock at %s:%i took %f", file, line, dur)); - } } void LockMutex::Unlock() @@ -101,6 +94,13 @@ void LockMutex::Unlock() locked = false; mutex.Unlock(); + + if(file && locked_at != -1) + { + float dur = RageTimer::GetTimeSinceStart() - locked_at; + if(dur > 0.015) + LOG->Trace(ssprintf("Lock at %s:%i took %f", file, line, dur)); + } } diff --git a/stepmania/src/RageThreads.h b/stepmania/src/RageThreads.h index a220d2986e..dcb69a6203 100644 --- a/stepmania/src/RageThreads.h +++ b/stepmania/src/RageThreads.h @@ -34,9 +34,9 @@ class LockMutex public: LockMutex(RageMutex &mut, const char *file, int line); - LockMutex(RageMutex &mut): mutex(mut), file(NULL), line(-1), locked_at(0) { mutex.Lock(); } + LockMutex(RageMutex &mut): mutex(mut), file(NULL), line(-1), locked_at(-1), locked(true) { mutex.Lock(); } ~LockMutex(); - LockMutex(LockMutex &cpy): mutex(cpy.mutex), file(cpy.file), line(cpy.line), locked_at(cpy.locked_at) { mutex.Lock(); } + LockMutex(LockMutex &cpy): mutex(cpy.mutex), file(NULL), line(-1), locked_at(cpy.locked_at), locked(true) { mutex.Lock(); } /* Unlock the mutex (before this would normally go out of scope). This can * only be called once. */