aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-12-30 21:38:42 -0800
committerChris Robinson <[email protected]>2018-12-30 21:38:42 -0800
commit9f5c9a2260849240bd680b8fdf533acdef7f9de1 (patch)
treed7e1c5873e323e7edcd96c1a2a037ea18063501c /OpenAL32
parent3df1d185f8bcf8d470249594a15d0e781a705ca2 (diff)
Rename BackendLock to StateLock
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMain.h6
-rw-r--r--OpenAL32/Include/alu.h2
-rw-r--r--OpenAL32/alAuxEffectSlot.cpp4
-rw-r--r--OpenAL32/alSource.cpp4
4 files changed, 10 insertions, 6 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index e23eb1fb..5e53a047 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -785,7 +785,11 @@ struct ALCdevice_struct {
// Contexts created on this device
std::atomic<ALCcontext*> ContextList{nullptr};
- std::mutex BackendLock;
+ /* This lock protects the device state (format, update size, etc) from
+ * being from being changed in multiple threads, or being accessed while
+ * being changed. It's also used to serialize calls to the backend.
+ */
+ std::mutex StateLock;
std::unique_ptr<BackendBase> Backend;
std::atomic<ALCdevice*> next{nullptr};
diff --git a/OpenAL32/Include/alu.h b/OpenAL32/Include/alu.h
index 7a378562..4fcc4c9c 100644
--- a/OpenAL32/Include/alu.h
+++ b/OpenAL32/Include/alu.h
@@ -478,7 +478,7 @@ void ComputePanGains(const ALeffectslot *slot, const ALfloat*RESTRICT coeffs, AL
ALboolean MixSource(ALvoice *voice, const ALuint SourceID, ALCcontext *Context, const ALsizei SamplesToDo);
void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples);
-/* Caller must lock the device, and the mixer must not be running. */
+/* Caller must lock the device state, and the mixer must not be running. */
void aluHandleDisconnect(ALCdevice *device, const char *msg, ...) DECL_FORMAT(printf, 2, 3);
extern MixerFunc MixSamples;
diff --git a/OpenAL32/alAuxEffectSlot.cpp b/OpenAL32/alAuxEffectSlot.cpp
index 1b3b97be..fc43edbe 100644
--- a/OpenAL32/alAuxEffectSlot.cpp
+++ b/OpenAL32/alAuxEffectSlot.cpp
@@ -556,12 +556,12 @@ ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect
FPUCtl mixer_mode{};
ALCdevice *Device{Context->Device};
- std::unique_lock<std::mutex> backlock{Device->BackendLock};
+ std::unique_lock<std::mutex> statelock{Device->StateLock};
State->mOutBuffer = Device->Dry.Buffer;
State->mOutChannels = Device->Dry.NumChannels;
if(State->deviceUpdate(Device) == AL_FALSE)
{
- backlock.unlock();
+ statelock.unlock();
mixer_mode.leave();
State->DecRef();
return AL_OUT_OF_MEMORY;
diff --git a/OpenAL32/alSource.cpp b/OpenAL32/alSource.cpp
index 069d600b..a3428e02 100644
--- a/OpenAL32/alSource.cpp
+++ b/OpenAL32/alSource.cpp
@@ -1726,7 +1726,7 @@ ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp prop, AL
* clock time with the device latency. Order is important.
*/
values[0] = GetSourceSecOffset(Source, Context, &srcclock);
- { std::lock_guard<std::mutex> _{device->BackendLock};
+ { std::lock_guard<std::mutex> _{device->StateLock};
clocktime = GetClockLatency(device);
}
if(srcclock == clocktime.ClockTime)
@@ -1989,7 +1989,7 @@ ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop,
* clock time with the device latency. Order is important.
*/
values[0] = GetSourceSampleOffset(Source, Context, &srcclock);
- { std::lock_guard<std::mutex> _{device->BackendLock};
+ { std::lock_guard<std::mutex> _{device->StateLock};
clocktime = GetClockLatency(device);
}
if(srcclock == clocktime.ClockTime)