don't wake up on Windows messages when waiting for thread termination in a console application as this results in an infinite loop because we never process them and thus they remain in the queue for always (modified patch 1615875; closes bugs 877128)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44344 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-02-02 22:46:48 +00:00
parent ac6e0eb154
commit e570a44b37
6 changed files with 36 additions and 12 deletions

View File

@@ -755,15 +755,16 @@ wxThreadInternal::WaitForTerminate(wxCriticalSection& cs,
#if !defined(QS_ALLPOSTMESSAGE)
#define QS_ALLPOSTMESSAGE 0
#endif
result = ::MsgWaitForMultipleObjects
(
1, // number of objects to wait for
&m_hThread, // the objects
false, // don't wait for all objects
INFINITE, // no timeout
QS_ALLINPUT|QS_ALLPOSTMESSAGE // return as soon as there are any events
);
wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL;
if ( traits )
{
result = traits->WaitForThread(m_hThread);
}
else // can't wait for the thread
{
// so kill it below
result = 0xFFFFFFFF;
}
switch ( result )
{
@@ -788,9 +789,6 @@ wxThreadInternal::WaitForTerminate(wxCriticalSection& cs,
// the system might dead lock then
if ( wxThread::IsMain() )
{
wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits()
: NULL;
if ( traits && !traits->DoMessageFromThreadWait() )
{
// WM_QUIT received: kill the thread