X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9e84b84742248ef54a561b4937bbc039332c2c51..229653c99e1d679aab15772a4a25909ca52c4d94:/src/msw/thread.cpp diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index b3bc923c68..d93d017704 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -32,6 +32,7 @@ #if wxUSE_THREADS #include "wx/msw/private.h" +#include "wx/msw/missing.h" #include "wx/module.h" #include "wx/thread.h" @@ -132,7 +133,7 @@ static bool gs_waitingForThread = FALSE; wxCriticalSection::wxCriticalSection() { - wxCOMPILE_TIME_ASSERT( sizeof(CRITICAL_SECTION) <= sizeof(m_buffer), + wxCOMPILE_TIME_ASSERT( sizeof(CRITICAL_SECTION) <= sizeof(wxCritSectBuffer), wxCriticalSectionBufferTooSmall ); ::InitializeCriticalSection((CRITICAL_SECTION *)m_buffer); @@ -971,10 +972,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 @@ -989,16 +986,27 @@ wxThreadError wxThread::Delete(ExitCode *pRc) // we can't just wait for the thread to terminate because it might be // calling some GUI functions and so it will never terminate before we // process the Windows messages that result from these functions - DWORD result; + DWORD result = 0; // suppress warnings from broken compilers 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 +1030,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 +1050,6 @@ wxThreadError wxThread::Delete(ExitCode *pRc) if ( IsMain() ) { gs_waitingForThread = FALSE; - -#if wxUSE_GUI - wxEndBusyCursor(); -#endif // wxUSE_GUI } }