attempt to fix race condition between Delete() and Wait()

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23700 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2003-09-19 00:19:50 +00:00
parent 3e5175b737
commit 63fa42b3be

View File

@ -599,9 +599,9 @@ wxThreadInternal::WaitForTerminate(bool shouldCancel,
{ {
if ( shouldCancel ) if ( shouldCancel )
{ {
// WinThreadStart() will see it and terminate immediately, no need // WinThreadStart() will see it and terminate immediately, no
// to cancel the thread - but we still need to resume it to let it // need to cancel the thread -- but we still need to resume it
// run // to let it run
m_state = STATE_EXITED; m_state = STATE_EXITED;
Resume(); // it knows about STATE_EXITED special case Resume(); // it knows about STATE_EXITED special case
@ -613,7 +613,11 @@ wxThreadInternal::WaitForTerminate(bool shouldCancel,
// shouldResume is correctly set to FALSE here // shouldResume is correctly set to FALSE here
} }
else else if ( m_state == STATE_EXITED )
{
return wxTHREAD_NOT_RUNNING;
}
else // running (but maybe paused or cancelled)
{ {
shouldResume = m_state == STATE_PAUSED; shouldResume = m_state == STATE_PAUSED;
} }