#if wxUSE_THREADS
#include "wx/msw/private.h"
+#include "wx/msw/missing.h"
#include "wx/module.h"
#include "wx/thread.h"
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);
{
// set flag for wxIsWaitingForThread()
gs_waitingForThread = TRUE;
-
-#if wxUSE_GUI
- wxBeginBusyCursor();
-#endif // wxUSE_GUI
}
// ask the thread to terminate
// 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 )
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:
if ( IsMain() )
{
gs_waitingForThread = FALSE;
-
-#if wxUSE_GUI
- wxEndBusyCursor();
-#endif // wxUSE_GUI
}
}