[openal] Thread-local context errors

Chris Robinson chris.kcat at gmail.com
Mon May 26 23:11:24 EDT 2014


Hi guys.

I'm currently considering ways to add a way to make context errors local 
to each thread (for a given context). There's a couple ways I'm thinking 
about handling it:

1 - A per-thread enable state. Calling

alEnable(AL_LOCAL_ERROR_STATE);

from a thread would cause any errors generated in the context on that 
thread to only be seen on that thread, and errors generated on other 
threads won't be seen on that one. Other threads that haven't called 
that would continue to use a global per-context error state.

or 2 - A context-creation attribute. Create a context like this:

ALCint attr[] = { ALC_LOCAL_ERROR_STATE, AL_TRUE, 0 };
context = alcCreateContext(device, attr);

Then any error generated in the created context will only be seen on the 
thread that generated it. This wouldn't affect other contexts or the device.


I'm leaning towards option 2, but I'd like to get other opinions.


More information about the openal mailing list