- ulrc = ::DosWaitThread( &hThread
- ,DCWW_NOWAIT
- );
- switch (ulrc)
- {
- case ERROR_INTERRUPT:
- case ERROR_INVALID_THREADID:
- // error
- wxLogSysError(_("Can not wait for thread termination"));
- Kill();
- return (ExitCode)-1;
-
- case 0:
- // thread we're waiting for terminated
- break;
-
- case ERROR_THREAD_NOT_TERMINATED:
- // new message arrived, process it
- if (!wxTheApp->DoMessage())
- {
- // WM_QUIT received: kill the thread
- Kill();
- return (ExitCode)-1;
- }
- if (IsMain())
- {
- // give the thread we're waiting for chance to exit
- // from the GUI call it might have been in
- if ((s_nWaitingForGui > 0) && wxGuiOwnedByMainThread())
- {
- wxMutexGuiLeave();
- }
- }
- break;
-
- default:
- wxFAIL_MSG(wxT("unexpected result of DosWatiThread"));
- }
- } while (ulrc != 0);