]> git.saurik.com Git - wxWidgets.git/commitdiff
attempt to fix race condition between Delete() and Wait()
authorVadim Zeitlin <vadim@wxwidgets.org>
Fri, 19 Sep 2003 00:19:50 +0000 (00:19 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Fri, 19 Sep 2003 00:19:50 +0000 (00:19 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23700 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/thread.cpp

index 3f273a4600ff90a4ed115ea9a618ec6a6b3ed5da..01378e3940f03dfd7516f6401e60b0642af9e116 100644 (file)
@@ -599,9 +599,9 @@ wxThreadInternal::WaitForTerminate(bool shouldCancel,
         {
             if ( shouldCancel )
             {
-                // WinThreadStart() will see it and terminate immediately, no need
-                // to cancel the thread - but we still need to resume it to let it
-                // run
+                // WinThreadStart() will see it and terminate immediately, no
+                // need to cancel the thread -- but we still need to resume it
+                // to let it run
                 m_state = STATE_EXITED;
 
                 Resume();   // it knows about STATE_EXITED special case
@@ -613,7 +613,11 @@ wxThreadInternal::WaitForTerminate(bool shouldCancel,
 
             // shouldResume is correctly set to FALSE here
         }
-        else
+        else if ( m_state == STATE_EXITED )
+        {
+            return wxTHREAD_NOT_RUNNING;
+        }
+        else // running (but maybe paused or cancelled)
         {
             shouldResume = m_state == STATE_PAUSED;
         }