Make ScopedMutexLock nothrow.

Wrong order of lock/unlock calls are programming errors and should be treated as such.
This commit is contained in:
Sönke Ludwig 2020-12-12 10:11:17 +01:00
parent ba6c058148
commit 34703d412d

View file

@ -132,21 +132,22 @@ struct ScopedMutexLock(M)
@property bool locked() const { return m_locked; }
void unlock()
{
in (this.locked)
do {
enforce(m_locked);
m_mutex.unlock();
m_locked = false;
}
bool tryLock()
{
enforce(!m_locked);
in (!this.locked)
do {
return m_locked = m_mutex.tryLock();
}
void lock()
{
enforce(!m_locked);
in (!this.locked)
do {
m_locked = true;
m_mutex.lock();
}