Change debug version "VibeMutexPrint" -> "VibeMutexLog".

This commit is contained in:
Sönke Ludwig 2016-10-04 17:53:40 +02:00
parent 6a1f2ddee3
commit 914e9ad894

View file

@ -1025,7 +1025,7 @@ private struct TaskMutexImpl(bool INTERRUPTIBLE) {
{ {
if (cas(&m_locked, false, true)) { if (cas(&m_locked, false, true)) {
debug m_owner = Task.getThis(); debug m_owner = Task.getThis();
debug(VibeMutexPrint) logTrace("mutex %s lock %s", cast(void*)&this, atomicLoad(m_waiters)); debug(VibeMutexLog) logTrace("mutex %s lock %s", cast(void*)&this, atomicLoad(m_waiters));
return true; return true;
} }
return false; return false;
@ -1036,7 +1036,7 @@ private struct TaskMutexImpl(bool INTERRUPTIBLE) {
if (tryLock()) return; if (tryLock()) return;
debug assert(m_owner == Task() || m_owner != Task.getThis(), "Recursive mutex lock."); debug assert(m_owner == Task() || m_owner != Task.getThis(), "Recursive mutex lock.");
atomicOp!"+="(m_waiters, 1); atomicOp!"+="(m_waiters, 1);
debug(VibeMutexPrint) logTrace("mutex %s wait %s", cast(void*)&this, atomicLoad(m_waiters)); debug(VibeMutexLog) logTrace("mutex %s wait %s", cast(void*)&this, atomicLoad(m_waiters));
scope(exit) atomicOp!"-="(m_waiters, 1); scope(exit) atomicOp!"-="(m_waiters, 1);
auto ecnt = m_signal.emitCount(); auto ecnt = m_signal.emitCount();
while (!tryLock()) { while (!tryLock()) {
@ -1053,7 +1053,7 @@ private struct TaskMutexImpl(bool INTERRUPTIBLE) {
m_owner = Task(); m_owner = Task();
} }
atomicStore!(MemoryOrder.rel)(m_locked, false); atomicStore!(MemoryOrder.rel)(m_locked, false);
debug(VibeMutexPrint) logTrace("mutex %s unlock %s", cast(void*)&this, atomicLoad(m_waiters)); debug(VibeMutexLog) logTrace("mutex %s unlock %s", cast(void*)&this, atomicLoad(m_waiters));
if (atomicLoad(m_waiters) > 0) if (atomicLoad(m_waiters) > 0)
m_signal.emit(); m_signal.emit();
} }
@ -1097,7 +1097,7 @@ private struct RecursiveTaskMutexImpl(bool INTERRUPTIBLE) {
{ {
if (tryLock()) return; if (tryLock()) return;
atomicOp!"+="(m_waiters, 1); atomicOp!"+="(m_waiters, 1);
debug(VibeMutexPrint) logTrace("mutex %s wait %s", cast(void*)&this, atomicLoad(m_waiters)); debug(VibeMutexLog) logTrace("mutex %s wait %s", cast(void*)&this, atomicLoad(m_waiters));
scope(exit) atomicOp!"-="(m_waiters, 1); scope(exit) atomicOp!"-="(m_waiters, 1);
auto ecnt = m_signal.emitCount(); auto ecnt = m_signal.emitCount();
while (!tryLock()) { while (!tryLock()) {
@ -1117,7 +1117,7 @@ private struct RecursiveTaskMutexImpl(bool INTERRUPTIBLE) {
m_owner = Task.init; m_owner = Task.init;
} }
}); });
debug(VibeMutexPrint) logTrace("mutex %s unlock %s", cast(void*)&this, atomicLoad(m_waiters)); debug(VibeMutexLog) logTrace("mutex %s unlock %s", cast(void*)&this, atomicLoad(m_waiters));
if (atomicLoad(m_waiters) > 0) if (atomicLoad(m_waiters) > 0)
m_signal.emit(); m_signal.emit();
} }