diff options
author | Chris Robinson <[email protected]> | 2018-02-04 00:01:12 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-02-04 00:01:12 -0800 |
commit | 9b878c64f9ec83adc4886db553ca184952ff50b4 (patch) | |
tree | db4df8b93f71ac2f0887d803f98314d8994011ea /Alc/ALu.c | |
parent | 1f61472e77faa0b57231b19236272d3e4d67fbc0 (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.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -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; |