Re: [5/6] wined3d: Make CreateFakeGLContext thread safe.

2006-12-04 Thread Alexandre Julliard
Jan Zerebecki [EMAIL PROTECTED] writes:

 This adds thread safety to CreateFakeGLContext and it's
 corresponding Release function only. This addresses no thread
 safety in the rest of wined3d, which AFAIk as a whole is still
 not thread safe. When addressing thread safety in wined3d it must
 also be taken care that a GL context is not deleted away by a
 different thread when execution is between these two functions.

You are calling ENTER_GL while holding your crit section, this will
deadlock.

-- 
Alexandre Julliard
[EMAIL PROTECTED]




Re: [5/6] wined3d: Make CreateFakeGLContext thread safe.

2006-11-22 Thread Jan Zerebecki
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 .