[Openal-devel] Thread-local contexts

Chris Robinson chris.kcat at gmail.com
Wed Sep 9 16:30:11 PDT 2009


On Wednesday 09 September 2009 4:06:25 pm Jason Daly wrote:
> Seems reasonable so far.  One question...
> 
> If you call (in the same thread):
> 
> ctx1 = alcCreateContext(...)
> ctx2 = alcCreateContext(...)
> ctx3 = alcCreateContext(...)
> 
> ...
> 
> alcMakeCurrent(ctx1)
> ...
> alcMakeThreadCurrent(ctx2)
> ...
> alcMakeCurrent(ctx3)
> 
> 
> Which context is current now?

ctx2 would be current for that thread (assuming you mean alcMakeContextCurrent 
for alcMakeCurrent). Both alcGetCurrentContext and alcGetThreadContext would 
return it.

For other threads that didn't have a thread-local context set, ctx3 would be 
current. alcGetCurrentContext would return ctx3, and alcGetThreadContext would 
return NULL.


More information about the Openal-devel mailing list