+ switch ( result )
+ {
+ case ERROR_INTERRUPT:
+ case ERROR_THREAD_NOT_TERMINATED:
+ break;
+ case ERROR_INVALID_THREADID:
+ case NO_ERROR:
+ // thread we're waiting for just terminated
+ // or even does not exist any more.
+ result = NO_ERROR;
+ break;
+ default:
+ wxFAIL_MSG(wxT("unexpected result of DosWaitThread"));
+ }
+ if ( IsMain() )
+ {
+ // event processing - needed if we are the main thread
+ // to give other threads a chance to do remaining GUI
+ // processing and terminate cleanly.
+ wxTheApp->HandleSockets();
+ if (wxTheApp->Pending())
+ if ( !wxTheApp->DoMessage() )
+ {
+ // WM_QUIT received: kill the thread
+ Kill();
+
+ return wxTHREAD_KILLED;
+ }
+ else
+ wxUsleep(10);
+ }
+ else
+ wxUsleep(10);
+ } while ( result != NO_ERROR );
+#else // !wxUSE_GUI
+ // simply wait for the thread to terminate
+ //
+ // OTOH, even console apps create windows (in wxExecute, for WinSock
+ // &c), so may be use MsgWaitForMultipleObject() too here?
+ if ( ::DosWaitThread(&hThread, DCWW_WAIT) != NO_ERROR )
+ {
+ wxFAIL_MSG(wxT("unexpected result of DosWaitThread"));
+ }