1
0
mirror of https://github.com/Zygo/bees.git synced 2025-06-15 17:26:15 +02:00

multilock: allow turning it off

Add a master switch to turn off the entire MultiLock infrastructure for
testing, without having to remove and add all the individual entry points.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
Zygo Blaxell
2024-11-21 16:26:05 -05:00
parent 72c3bf8438
commit 606ac01d56
2 changed files with 15 additions and 2 deletions

View File

@ -62,11 +62,22 @@ namespace crucible {
return rv;
}
static MultiLocker s_process_instance;
shared_ptr<MultiLocker::LockHandle>
MultiLocker::get_lock(const string &type)
{
static MultiLocker s_process_instance;
return s_process_instance.get_lock_private(type);
if (s_process_instance.m_do_locking) {
return s_process_instance.get_lock_private(type);
} else {
return shared_ptr<MultiLocker::LockHandle>();
}
}
void
MultiLocker::enable_locking(const bool enabled)
{
s_process_instance.m_do_locking = enabled;
}
}