aboutsummaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-11-26 21:50:48 -0800
committerChris Robinson <[email protected]>2018-11-26 21:50:48 -0800
commit68eef6abb4f48262ec4d514fb3c77b8d4e9c0bf7 (patch)
tree644a5729c2e548aa61ec384536dcf98ded1a020a /Alc
parent2e73c2ca929b6cea23195270fe144f9ad3ae5c27 (diff)
Use a standard mutex for the source and effect slot locks
Diffstat (limited to 'Alc')
-rw-r--r--Alc/alc.cpp9
-rw-r--r--Alc/alcontext.h4
2 files changed, 4 insertions, 9 deletions
diff --git a/Alc/alc.cpp b/Alc/alc.cpp
index d6331862..0bb6fbf6 100644
--- a/Alc/alc.cpp
+++ b/Alc/alc.cpp
@@ -2261,7 +2261,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
}
std::unique_lock<std::mutex> proplock{context->PropLock};
- std::unique_lock<almtx_t> slotlock{context->EffectSlotLock};
+ std::unique_lock<std::mutex> slotlock{context->EffectSlotLock};
for(auto &slot : context->EffectSlotList)
{
EffectState *state = slot->Effect.State;
@@ -2275,7 +2275,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList)
}
slotlock.unlock();
- std::unique_lock<almtx_t> srclock{context->SourceLock};
+ std::unique_lock<std::mutex> srclock{context->SourceLock};
for(auto &sublist : context->SourceList)
{
uint64_t usemask = ~sublist.FreeMask;
@@ -2513,9 +2513,6 @@ static ALvoid InitContext(ALCcontext *Context)
struct ALeffectslotArray *auxslots;
//Validate Context
- almtx_init(&Context->SourceLock, almtx_plain);
- almtx_init(&Context->EffectSlotLock, almtx_plain);
-
if(Context->DefaultSlot)
{
auxslots = static_cast<ALeffectslotArray*>(al_calloc(DEF_ALIGN,
@@ -2596,7 +2593,6 @@ ALCcontext_struct::~ALCcontext_struct()
WARN(SZFMT " Source%s not deleted\n", count, (count==1)?"":"s");
SourceList.clear();
NumSources = 0;
- almtx_destroy(&SourceLock);
count = 0;
struct ALeffectslotProps *eprops{FreeEffectslotProps.load(std::memory_order_acquire)};
@@ -2616,7 +2612,6 @@ ALCcontext_struct::~ALCcontext_struct()
if(count > 0)
WARN(SZFMT " AuxiliaryEffectSlot%s not deleted\n", count, (count==1)?"":"s");
EffectSlotList.clear();
- almtx_destroy(&EffectSlotLock);
count = 0;
struct ALvoiceProps *vprops{FreeVoiceProps.load(std::memory_order_acquire)};
diff --git a/Alc/alcontext.h b/Alc/alcontext.h
index 0b285bfb..426d06e8 100644
--- a/Alc/alcontext.h
+++ b/Alc/alcontext.h
@@ -66,10 +66,10 @@ struct ALCcontext_struct {
al::vector<SourceSubList> SourceList;
ALuint NumSources{0};
- almtx_t SourceLock;
+ std::mutex SourceLock;
al::vector<ALeffectslotPtr> EffectSlotList;
- almtx_t EffectSlotLock;
+ std::mutex EffectSlotLock;
std::atomic<ALenum> LastError{AL_NO_ERROR};