aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-12-04 14:48:08 -0800
committerChris Robinson <[email protected]>2018-12-04 14:48:08 -0800
commita0967967de999d1381e827aa4a73fc9e80ec031b (patch)
tree385ce4fbc5909654aa791d1f495019af59822201
parent31b54eb86a25457e561f4e27324163def0a8bd66 (diff)
Read atomic variables in the reverse order they're set
-rw-r--r--Alc/alu.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/Alc/alu.cpp b/Alc/alu.cpp
index 197d554d..facb70ed 100644
--- a/Alc/alu.cpp
+++ b/Alc/alu.cpp
@@ -1515,10 +1515,9 @@ void ProcessContext(ALCcontext *ctx, ALsizei SamplesToDo)
std::for_each(ctx->Voices, ctx->Voices+ctx->VoiceCount.load(std::memory_order_acquire),
[SamplesToDo,ctx](ALvoice *voice) -> void
{
- ALuint sid{voice->SourceID.load(std::memory_order_acquire)};
- if(!sid) return;
- if(!voice->Playing.load(std::memory_order_relaxed) || voice->Step < 1)
- return;
+ if(!voice->Playing.load(std::memory_order_acquire)) return;
+ ALuint sid{voice->SourceID.load(std::memory_order_relaxed)};
+ if(!sid || voice->Step < 1) return;
if(!MixSource(voice, sid, ctx, SamplesToDo))
{
@@ -1841,9 +1840,9 @@ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...)
std::for_each(ctx->Voices, ctx->Voices+ctx->VoiceCount.load(std::memory_order_acquire),
[ctx](ALvoice *voice) -> void
{
+ if(!voice->Playing.load(std::memory_order_acquire)) return;
ALuint sid{voice->SourceID.load(std::memory_order_relaxed)};
- if(!sid || !voice->Playing.load(std::memory_order_relaxed))
- return;
+ if(!sid) return;
voice->SourceID.store(0u, std::memory_order_relaxed);
voice->Playing.store(false, std::memory_order_release);