aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALu.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-02-04 00:01:12 -0800
committerChris Robinson <[email protected]>2018-02-04 00:01:12 -0800
commit9b878c64f9ec83adc4886db553ca184952ff50b4 (patch)
treedb4df8b93f71ac2f0887d803f98314d8994011ea /Alc/ALu.c
parent1f61472e77faa0b57231b19236272d3e4d67fbc0 (diff)
Make the Connected state atomic
Also don't send the Disconnected event more than once.
Diffstat (limited to 'Alc/ALu.c')
-rw-r--r--Alc/ALu.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Alc/ALu.c b/Alc/ALu.c
index 9f4f7a30..2435558d 100644
--- a/Alc/ALu.c
+++ b/Alc/ALu.c
@@ -1857,7 +1857,8 @@ void aluHandleDisconnect(ALCdevice *device, const char *msg, ...)
va_list args;
int msglen;
- device->Connected = ALC_FALSE;
+ if(!ATOMIC_EXCHANGE(&device->Connected, AL_FALSE, almemory_order_acq_rel))
+ return;
evt.EnumType = EventType_Disconnected;
evt.Type = AL_EVENT_TYPE_DISCONNECTED_SOFT;