aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/base.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-15 03:49:59 -0800
committerChris Robinson <[email protected]>2018-11-15 03:49:59 -0800
commitd4f64b9e29319f56f2ecab1291918a52ec8336f1 (patch)
tree63e9dade7a1a08b2422ae3c37ee008188e20a677 /Alc/backends/base.cpp
parentb7daddb564cfa551c9dcc983bdc0e6bc53cc67d3 (diff)
Use a C++ mutex with the device backend base
Diffstat (limited to 'Alc/backends/base.cpp')
-rw-r--r--Alc/backends/base.cpp21
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();
+ }
}