From 530597347c664277d91d5efc7fff8d10092f2e20 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Thu, 12 Jan 2012 06:13:24 -0800 Subject: Safely insert the new context into the list --- Alc/ALc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Alc/ALc.c') diff --git a/Alc/ALc.c b/Alc/ALc.c index 5bef5d51..69b572ac 100644 --- a/Alc/ALc.c +++ b/Alc/ALc.c @@ -2205,8 +2205,9 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin ALCdevice_IncRef(device); InitContext(ALContext); - ALContext->next = device->ContextList; - device->ContextList = ALContext; + do { + ALContext->next = device->ContextList; + } while(!CompExchangePtr((XchgPtr*)&device->ContextList, ALContext->next, ALContext)); UnlockLists(); ALCdevice_DecRef(device); -- cgit v1.2.3