1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:27:42 +00:00

Kernel: Reduce LOCK_DEBUG ifdefs by utilizing Kernel::LockLocation

The LOCK_DEBUG conditional code is pretty ugly for a feature that we
only use rarely. We can remove a significant amount of this code by
utilizing a zero sized fake type when not building in LOCK_DEBUG mode.

This lets us keep the same API, but just let the compiler optimize it
away when don't actually care about the location the caller came from.
This commit is contained in:
Brian Gianforcaro 2021-08-07 04:19:39 -07:00 committed by Andreas Kling
parent 6c18b4e558
commit bea74f4b77
4 changed files with 13 additions and 53 deletions

View file

@ -514,7 +514,7 @@ void Thread::finalize()
dbgln("Thread {} leaking {} Locks!", *this, lock_count());
ScopedSpinLock list_lock(m_holding_locks_lock);
for (auto& info : m_holding_locks_list) {
const auto& location = info.source_location;
const auto& location = info.lock_location;
dbgln(" - Mutex: \"{}\" @ {} locked in function \"{}\" at \"{}:{}\" with a count of: {}", info.lock->name(), info.lock, location.function_name(), location.filename(), location.line_number(), info.count);
}
VERIFY_NOT_REACHED();