wxThread::Delete() doesn't wait until the next event occurs before waking up any longer

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15897 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-06-20 22:25:28 +00:00
parent d1148d2418
commit 1420518999

View File

@@ -971,10 +971,6 @@ wxThreadError wxThread::Delete(ExitCode *pRc)
{ {
// set flag for wxIsWaitingForThread() // set flag for wxIsWaitingForThread()
gs_waitingForThread = TRUE; gs_waitingForThread = TRUE;
#if wxUSE_GUI
wxBeginBusyCursor();
#endif // wxUSE_GUI
} }
// ask the thread to terminate // ask the thread to terminate
@@ -992,13 +988,24 @@ wxThreadError wxThread::Delete(ExitCode *pRc)
DWORD result; DWORD result;
do do
{ {
if ( IsMain() )
{
// give the thread we're waiting for chance to do the GUI call
// it might be in
if ( (gs_nWaitingForGui > 0) && wxGuiOwnedByMainThread() )
{
wxMutexGuiLeave();
}
}
result = ::MsgWaitForMultipleObjects result = ::MsgWaitForMultipleObjects
( (
1, // number of objects to wait for 1, // number of objects to wait for
&hThread, // the objects &hThread, // the objects
FALSE, // don't wait for all objects FALSE, // don't wait for all objects
INFINITE, // no timeout INFINITE, // no timeout
QS_ALLEVENTS // return as soon as there are any events QS_ALLINPUT | // return as soon as there are any events
QS_ALLPOSTMESSAGE
); );
switch ( result ) switch ( result )
@@ -1022,17 +1029,6 @@ wxThreadError wxThread::Delete(ExitCode *pRc)
return wxTHREAD_KILLED; return wxTHREAD_KILLED;
} }
if ( IsMain() )
{
// give the thread we're waiting for chance to exit
// from the GUI call it might have been in
if ( (gs_nWaitingForGui > 0) && wxGuiOwnedByMainThread() )
{
wxMutexGuiLeave();
}
}
break; break;
default: default:
@@ -1053,10 +1049,6 @@ wxThreadError wxThread::Delete(ExitCode *pRc)
if ( IsMain() ) if ( IsMain() )
{ {
gs_waitingForThread = FALSE; gs_waitingForThread = FALSE;
#if wxUSE_GUI
wxEndBusyCursor();
#endif // wxUSE_GUI
} }
} }