diff options
author | Chris Robinson <[email protected]> | 2018-11-15 03:49:59 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-11-15 03:49:59 -0800 |
commit | d4f64b9e29319f56f2ecab1291918a52ec8336f1 (patch) | |
tree | 63e9dade7a1a08b2422ae3c37ee008188e20a677 /Alc/backends/base.cpp | |
parent | b7daddb564cfa551c9dcc983bdc0e6bc53cc67d3 (diff) |
Use a C++ mutex with the device backend base
Diffstat (limited to 'Alc/backends/base.cpp')
-rw-r--r-- | Alc/backends/base.cpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/Alc/backends/base.cpp b/Alc/backends/base.cpp index 4a20518d..340ca7ac 100644 --- a/Alc/backends/base.cpp +++ b/Alc/backends/base.cpp @@ -26,14 +26,11 @@ ClockLatency GetClockLatency(ALCdevice *device) /* Base ALCbackend method implementations. */ void ALCbackend_Construct(ALCbackend *self, ALCdevice *device) { - int ret = almtx_init(&self->mMutex, almtx_recursive); - assert(ret == althrd_success); self->mDevice = device; } -void ALCbackend_Destruct(ALCbackend *self) +void ALCbackend_Destruct(ALCbackend* UNUSED(self)) { - almtx_destroy(&self->mMutex); } ALCboolean ALCbackend_reset(ALCbackend* UNUSED(self)) @@ -76,14 +73,22 @@ ClockLatency ALCbackend_getClockLatency(ALCbackend *self) void ALCbackend_lock(ALCbackend *self) { - int ret = almtx_lock(&self->mMutex); - assert(ret == althrd_success); + try { + self->mMutex.lock(); + } + catch(...) { + std::terminate(); + } } void ALCbackend_unlock(ALCbackend *self) { - int ret = almtx_unlock(&self->mMutex); - assert(ret == althrd_success); + try { + self->mMutex.unlock(); + } + catch(...) { + std::terminate(); + } } |