From 63fa42b3bedaf167004c95cc46339849ee9d7424 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 19 Sep 2003 00:19:50 +0000 Subject: [PATCH] attempt to fix race condition between Delete() and Wait() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23700 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/thread.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/msw/thread.cpp b/src/msw/thread.cpp index 3f273a4600..01378e3940 100644 --- a/src/msw/thread.cpp +++ b/src/msw/thread.cpp @@ -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; } -- 2.45.2