-//-----------------------------------------------------------------------------
-// wxYield
-//-----------------------------------------------------------------------------
-
-static bool gs_inYield = FALSE;
-
-bool wxApp::Yield(bool onlyIfNeeded)
-{
- if ( gs_inYield )
- {
- if ( !onlyIfNeeded )
- {
- wxFAIL_MSG( wxT("wxYield called recursively" ) );
- }
-
- return FALSE;
- }
-
-#if wxUSE_THREADS
- if ( !wxThread::IsMain() )
- {
- // can't process events from other threads, MGL is thread-unsafe
- return TRUE;
- }
-#endif // wxUSE_THREADS
-
- gs_inYield = TRUE;
-
- wxLog::Suspend();
-
- if ( wxEventLoop::GetActive() )
- {
- while (wxEventLoop::GetActive()->Pending())
- wxEventLoop::GetActive()->Dispatch();
- }
-
- /* it's necessary to call ProcessIdle() to update the frames sizes which
- might have been changed (it also will update other things set from
- OnUpdateUI() which is a nice (and desired) side effect) */
- while (wxTheApp->ProcessIdle()) { }
-
- wxLog::Resume();
-
- gs_inYield = FALSE;
-
- return TRUE;
-}
-