-//
-// Yield to incoming messages
-//
-bool wxApp::Yield(bool onlyIfNeeded)
-{
- static bool s_inYield = false;
-
- if ( s_inYield )
- {
- if ( !onlyIfNeeded )
- {
- wxFAIL_MSG( _T("wxYield() called recursively") );
- }
-
- return false;
- }
-
- HAB vHab = 0;
- QMSG vMsg;
-
- //
- // Disable log flushing from here because a call to wxYield() shouldn't
- // normally result in message boxes popping up &c
- //
- wxLog::Suspend();
-
- s_inYield = true;
-
- //
- // We want to go back to the main message loop
- // if we see a WM_QUIT. (?)
- //
- while (::WinPeekMsg(vHab, &vMsg, (HWND)NULL, 0, 0, PM_NOREMOVE) && vMsg.msg != WM_QUIT)
- {
-#if wxUSE_THREADS
- wxMutexGuiLeaveOrEnter();
-#endif // wxUSE_THREADS
- if (!wxTheApp->Dispatch())
- break;
- }
- //
- // If they are pending events, we must process them.
- //
- if (wxTheApp)
- wxTheApp->ProcessPendingEvents();
-
- HandleSockets();
- //
- // Let the logs be flashed again
- //
- wxLog::Resume();
- s_inYield = false;
- return true;
-} // end of wxYield
-