diff options
author | Chris Robinson <[email protected]> | 2011-08-29 13:22:07 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-08-29 13:22:07 -0700 |
commit | 72beb577b6190d9df0426825f131a5c8624aaeec (patch) | |
tree | fbc6653d88aee582cc7a5751ecc48762c82fa544 /Alc/ALc.c | |
parent | de65ee08c9c3b2261b8329d45cb57b4b4e5cb6a1 (diff) |
Lock the context as needed for the defer and process calls
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r-- | Alc/ALc.c | 28 |
1 files changed, 26 insertions, 2 deletions
@@ -1361,14 +1361,14 @@ static ALCvoid FreeContext(ALCcontext *context) free(context); } -static void ALCcontext_IncRef(ALCcontext *context) +void ALCcontext_IncRef(ALCcontext *context) { RefCount ref; ref = IncrementRef(&context->ref); TRACE("%p refcount increment to %d\n", context, ref); } -static void ALCcontext_DecRef(ALCcontext *context) +void ALCcontext_DecRef(ALCcontext *context) { RefCount ref; ref = DecrementRef(&context->ref); @@ -1418,6 +1418,30 @@ ALCcontext *GetLockedContext(void) return context; } +/* + * GetReffedContext(void) + * + * Returns the currently active Context, and add a reference to it without + * locking + */ +ALCcontext *GetReffedContext(void) +{ + ALCcontext *context; + + context = pthread_getspecific(LocalContext); + if(context) + ALCcontext_IncRef(context); + else + { + LockLists(); + context = GlobalContext; + if(context) + ALCcontext_IncRef(context); + UnlockLists(); + } + + return context; +} /////////////////////////////////////////////////////// |