aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-21 05:35:47 -0800
committerChris Robinson <[email protected]>2018-11-21 05:35:47 -0800
commit75213ee6f951355906bd1744a2936bb764f23e40 (patch)
treead33740d5373728f995213e60af6d06d19782ccb /common
parent757c42c74bb1f88dfc6f24200382a0ea741fccac (diff)
Always use RAII with EffectSlotLock
Diffstat (limited to 'common')
-rw-r--r--common/threads.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/common/threads.h b/common/threads.h
index 0b53c38f..8fd1093d 100644
--- a/common/threads.h
+++ b/common/threads.h
@@ -137,7 +137,7 @@ public:
using mutex_type = almtx_t;
explicit lock_guard(almtx_t &mtx) : mMtx(mtx) { almtx_lock(&mMtx); }
- lock_guard(almtx_t &mtx, std::adopt_lock_t) : mMtx(mtx) { }
+ lock_guard(almtx_t &mtx, std::adopt_lock_t) noexcept : mMtx(mtx) { }
~lock_guard() { almtx_unlock(&mMtx); }
lock_guard(const lock_guard&) = delete;
@@ -152,8 +152,9 @@ class unique_lock<almtx_t> {
public:
using mutex_type = almtx_t;
+ unique_lock() noexcept = default;
explicit unique_lock(almtx_t &mtx) : mMtx(&mtx) { almtx_lock(mMtx); mLocked = true; }
- unique_lock(unique_lock&& rhs) : mMtx(rhs.mMtx), mLocked(rhs.mLocked)
+ unique_lock(unique_lock&& rhs) noexcept : mMtx(rhs.mMtx), mLocked(rhs.mLocked)
{ rhs.mMtx = nullptr; rhs.mLocked = false; }
~unique_lock() { if(mLocked) almtx_unlock(mMtx); }