I suppose 32-bit reads are atomic on x86, provided the variable is aligned correctly, but shouldn't access to CurrentCtx technically be synchronized?
On Tuesday 01 September 2009 1:59:54 am Henri Verbeet wrote:
I suppose 32-bit reads are atomic on x86, provided the variable is aligned correctly, but shouldn't access to CurrentCtx technically be synchronized?
Probably, but I'm not sure it would be beneficial. If the thread can be interrupted between entering one of the extended functions and the function pointer being called, it would be a pretty nasty race condition. OpenAL doesn't really say what happens when you call a function for a context that's not active (current Windows implementations, if they haven't changed too much, would likely crash, silently fail, or succeed using the wrong device).
I'm not sure the cost of an extra lock would be worth it when it could still randomly crash anyway.