summaryrefslogtreecommitdiffstats
path: root/Alc
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2012-01-12 06:13:24 -0800
committerChris Robinson <[email protected]>2012-01-12 06:13:24 -0800
commit530597347c664277d91d5efc7fff8d10092f2e20 (patch)
tree442fbceda77ca45bfb8c89f4e722e24074614fae /Alc
parentc543611897e03eb89feb0885eb61010f5f94a515 (diff)
Safely insert the new context into the list
Diffstat (limited to 'Alc')
-rw-r--r--Alc/ALc.c5
1 files changed, 3 insertions, 2 deletions
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);