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; }
|
||||
|
||||
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();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue