Make ScopedMutexLock nothrow.
Wrong order of lock/unlock calls are programming errors and should be treated as such.
This commit is contained in:
parent
ba6c058148
commit
34703d412d
|
@ -132,21 +132,22 @@ struct ScopedMutexLock(M)
|
||||||
@property bool locked() const { return m_locked; }
|
@property bool locked() const { return m_locked; }
|
||||||
|
|
||||||
void unlock()
|
void unlock()
|
||||||
{
|
in (this.locked)
|
||||||
|
do {
|
||||||
enforce(m_locked);
|
enforce(m_locked);
|
||||||
m_mutex.unlock();
|
m_mutex.unlock();
|
||||||
m_locked = false;
|
m_locked = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool tryLock()
|
bool tryLock()
|
||||||
{
|
in (!this.locked)
|
||||||
enforce(!m_locked);
|
do {
|
||||||
return m_locked = m_mutex.tryLock();
|
return m_locked = m_mutex.tryLock();
|
||||||
}
|
}
|
||||||
|
|
||||||
void lock()
|
void lock()
|
||||||
{
|
in (!this.locked)
|
||||||
enforce(!m_locked);
|
do {
|
||||||
m_locked = true;
|
m_locked = true;
|
||||||
m_mutex.lock();
|
m_mutex.lock();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue