- return res;
-}
-
-#endif // HAVE_POLL/!HAVE_POLL
-
-static gint wxapp_poll_func( GPollFD *ufds, guint nfds, gint timeout )
-{
- gdk_threads_enter();
-
- wxMutexGuiLeave();
- g_mainThreadLocked = TRUE;
-
- // we rely on the fact that glib GPollFD struct is really just pollfd but
- // I wonder how wise is this in the long term (VZ)
- gint res = wxPoll( (wxPollFd *) ufds, nfds, timeout );
-
- wxMutexGuiEnter();
- g_mainThreadLocked = FALSE;
-
- gdk_threads_leave();
-
- return res;
-}
-
-#endif // wxUSE_THREADS
-
-} // extern "C"
-
-void wxapp_install_idle_handler()
-{
-#if wxUSE_THREADS
- wxMutexLocker lock(gs_idleTagsMutex);
-#endif
-
- // Don't install the handler if it's already installed. This test *MUST*
- // be done when gs_idleTagsMutex is locked!
- if (!g_isIdle)
- return;
-
- // GD: this assert is raised when using the thread sample (which works)
- // so the test is probably not so easy. Can widget callbacks be
- // triggered from child threads and, if so, for which widgets?
- // wxASSERT_MSG( wxThread::IsMain() || gs_WakeUpIdle, wxT("attempt to install idle handler from widget callback in child thread (should be exclusively from wxWakeUpIdle)") );
-
- wxASSERT_MSG( wxTheApp->m_idleTag == 0, wxT("attempt to install idle handler twice") );
-
- g_isIdle = FALSE;
-
- if (g_pendingTag == 0)
- g_pendingTag = gtk_idle_add_priority( 900, wxapp_pending_callback, (gpointer) NULL );
-
- // This routine gets called by all event handlers
- // indicating that the idle is over. It may also
- // get called from other thread for sending events
- // to the main thread (and processing these in
- // idle time). Very low priority.
- wxTheApp->m_idleTag = gtk_idle_add_priority( 1000, wxapp_idle_callback, (gpointer) NULL );