On Tue, Nov 21, 2006 at 07:10:30PM +0800, Dmitry Timoshkov wrote: > You could avoid a call to LeaveCriticalSection by moving > EnterCriticalSection > after the wined3d_fake_gl_context_available check.
This would make this sequence of events (perhaps only in theory) possible: release wined3d_fake_gl_context_available==FALSE create enter lock create wined3d_fake_gl_context_available=TRUE create leave lock release TRACE_(d3d_caps)("context not available\n"); release return Though this is not realy a race condition, the trace doesn't realy tell the whole truth in this sequence of events, either. I think it's easier to see that the original code has correct locking (compared to your suggestion) and as this part of the code is not realy time critical, I prefer to leave it that way. Jan PS: Please try to honor Mail-Followup-To .