aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/backends/base.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-04-16 01:39:11 -0700
committerChris Robinson <[email protected]>2014-04-16 01:39:11 -0700
commit29cb5058c0b05cca8ebeb40d84aba8a8d2e11075 (patch)
tree749d963f365901b22eabd8eaf164f38f2efb8789 /Alc/backends/base.c
parent9c70ca9da6479595946def59cd616e6823c86d78 (diff)
Use a C11-like mutex wrapper instead of CRITICAL_SECTIONs
Diffstat (limited to 'Alc/backends/base.c')
-rw-r--r--Alc/backends/base.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Alc/backends/base.c b/Alc/backends/base.c
index 8e59abdf..37e4ccc9 100644
--- a/Alc/backends/base.c
+++ b/Alc/backends/base.c
@@ -11,13 +11,15 @@
/* Base ALCbackend method implementations. */
void ALCbackend_Construct(ALCbackend *self, ALCdevice *device)
{
+ int ret;
self->mDevice = device;
- InitializeCriticalSection(&self->mMutex);
+ ret = almtx_init(&self->mMutex, almtx_recursive);
+ assert(ret == althrd_success);
}
void ALCbackend_Destruct(ALCbackend *self)
{
- DeleteCriticalSection(&self->mMutex);
+ almtx_destroy(&self->mMutex);
}
ALCboolean ALCbackend_reset(ALCbackend* UNUSED(self))
@@ -42,12 +44,14 @@ ALint64 ALCbackend_getLatency(ALCbackend* UNUSED(self))
void ALCbackend_lock(ALCbackend *self)
{
- EnterCriticalSection(&self->mMutex);
+ int ret = almtx_lock(&self->mMutex);
+ assert(ret == althrd_success);
}
void ALCbackend_unlock(ALCbackend *self)
{
- LeaveCriticalSection(&self->mMutex);
+ int ret = almtx_unlock(&self->mMutex);
+ assert(ret == althrd_success);
}