Bug 2767 - Dual Core machines exhibit a thread deadlock
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Platform
Version: unspecified
Hardware: PC Windows XP
: P2 major
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2006-06-29 18:29 EDT by Daniel Deptford
Modified: 2007-05-21 11:26:50 EDT
1 user (show)

See Also:



Description Daniel Deptford 2006-06-29 18:29:53 EDT
Dual core machines block frequently when running vanilla q3, usually on startup.

I've located this to win_glimp.c, line 1637.

Heres the execution path that blocks:

Thread 1 (T1) is running GLimp_RendererSleep:
Thread 2 (T2) is running GLimp_WakeRenderer:

T1 resets renderActiveEvent
T2 sets the renderCommandsEvent event
T1 waits on the renderCommandsEvent event, passing through
T1 resets the renderCommandsEvent event
T1 resets renderActiveEvent event

T1 then executes GLimp_RendererSleep again, resetting renderActiveEvent
T2 waits on renderActiveEvent, which is unset.

Because T1 reset renderCommandsEvent earlier, it blocks on waiting for it.  T2 hasnt set it, because its already set it and is waiting on renderActiveEvent, which T1 already unset.

This can be fixed by moving the line:
ResetEvent( renderActiveEvent );
from line 1637 to just after WaitForSingleObject( renderCommandsEvent, INFINITE ); on line 1642.
Comment 1 Tim Angus 2006-07-31 15:05:36 EDT
Committed.
Comment 2 Ryan C. Gordon 2007-05-21 11:26:50 EDT
Setting a QA contact on all ioquake3 bugs, even resolved ones. Sorry if you get a flood of email from this, it should only happen once. Apologies for the incovenience.

--ryan.