]> git.saurik.com Git - wxWidgets.git/commitdiff
wxThread::Delete() doesn't wait until the next event occurs before waking up any...
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 20 Jun 2002 22:25:28 +0000 (22:25 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 20 Jun 2002 22:25:28 +0000 (22:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15897 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/thread.cpp

index b3bc923c6877110b8bc2c5f703ccc49afc0d1c97..0f5886b86fa783a752989fe60518eba31907e48a 100644 (file)
@@ -971,10 +971,6 @@ wxThreadError wxThread::Delete(ExitCode *pRc)
         {
             // set flag for wxIsWaitingForThread()
             gs_waitingForThread = TRUE;
         {
             // set flag for wxIsWaitingForThread()
             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;
         do
         {
         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
             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 )
                      );
 
             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;
 
                 default:
                     break;
 
                 default:
@@ -1053,10 +1049,6 @@ wxThreadError wxThread::Delete(ExitCode *pRc)
         if ( IsMain() )
         {
             gs_waitingForThread = FALSE;
         if ( IsMain() )
         {
             gs_waitingForThread = FALSE;
-
-#if wxUSE_GUI
-            wxEndBusyCursor();
-#endif // wxUSE_GUI
         }
     }
 
         }
     }