From: Vadim Zeitlin Date: Thu, 20 Jun 2002 22:25:28 +0000 (+0000) Subject: wxThread::Delete() doesn't wait until the next event occurs before waking up any... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/1420518999cdfc3365d1986003d63c18dc6ae872 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 --- diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index b3bc923c68..0f5886b86f 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -971,10 +971,6 @@ wxThreadError wxThread::Delete(ExitCode *pRc) { // set flag for wxIsWaitingForThread() gs_waitingForThread = TRUE; - -#if wxUSE_GUI - wxBeginBusyCursor(); -#endif // wxUSE_GUI } // ask the thread to terminate @@ -992,13 +988,24 @@ wxThreadError wxThread::Delete(ExitCode *pRc) DWORD result; 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 ( 1, // number of objects to wait for &hThread, // the objects FALSE, // don't wait for all objects 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 ) @@ -1022,17 +1029,6 @@ wxThreadError wxThread::Delete(ExitCode *pRc) 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; default: @@ -1053,10 +1049,6 @@ wxThreadError wxThread::Delete(ExitCode *pRc) if ( IsMain() ) { gs_waitingForThread = FALSE; - -#if wxUSE_GUI - wxEndBusyCursor(); -#endif // wxUSE_GUI } }