Use an atomic exchange to get the old global context when setting a new one
This commit is contained in:
@@ -2231,9 +2231,10 @@ ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context)
|
||||
// context must be a valid Context or NULL
|
||||
if(context == NULL || IsContext(context))
|
||||
{
|
||||
ALCcontext *old = GlobalContext;
|
||||
ALCcontext *old;
|
||||
|
||||
if(context) ALCcontext_IncRef(context);
|
||||
GlobalContext = context;
|
||||
old = ExchangePtr((void**)&GlobalContext, context);
|
||||
if(old) ALCcontext_DecRef(old);
|
||||
|
||||
if((old=pthread_getspecific(LocalContext)) != NULL)
|
||||
|
||||
Reference in New Issue
Block a user