vcl mainloop bits ...
Michael Meeks
michael.meeks at suse.com
Tue Jul 9 09:29:09 PDT 2013
Hi there,
Am struggling to unwind the intent of the appended ;-) a little healthy
paranoia with the glib mainloop integration is sensible since small
changes there affect a ton of unexpected orderings in the code and ... -
anyhow ;-)
commit 21a9089aa4324ccbdc9e9ee3669e5fb524efd03c
Author: Pierre-Eric Pelloux-Prayer <pierre-eric at lanedo.com>
Date: Fri Jul 5 14:17:46 2013 +0200
The description seems to suggest that:
gtk/unx: remove successive calls to g_main_context_iteration
Replace the sequence:
...
blocking call to g_main_context_iteration until first evt reveived.
This allows more longer sleep period, when nothing is going on (verified
with strace).
...
diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx
index 6abb06b..5ff5a80 100644
--- a/vcl/unx/gtk/app/gtkdata.cxx
+++ b/vcl/unx/gtk/app/gtkdata.cxx
@@ -571,12 +571,10 @@ void GtkData::Yield( bool bWait, bool bHandleAllCurrentEvents )
gboolean wasOneEvent = TRUE;
while( nMaxEvents-- && wasOneEvent )
{
- wasOneEvent = g_main_context_iteration( NULL, FALSE );
+ wasOneEvent = g_main_context_iteration( NULL, bWait & !bWasEvent );
if( wasOneEvent )
bWasEvent = true;
}
- if( bWait && ! bWasEvent )
- bWasEvent = g_main_context_iteration( NULL, TRUE ) != 0;
}
Of course - the old code was pretty odd and ugly - but I read the above
for the bWait == TRUE case - which I assume you're optimising as:
while ( 1-- && TRUE )
{
wasOneEvent = g_main_context_iteration (NULL, bWait && FALSE );
The first time around - right ? seems like that does a non-waiting run
through the main-loop as before.
what somewhat concerns me is that in the case ofbHandleAllCurrentEvents
== FALSE and bWait == TRUE - we have a different behaviour - we don't
wait nMaxEvents == 0 now - and we bail out.
Couldn't that create a busy loop ?
Anyhow - thanks for being brave enough to touch this :-) the main-loop
logic clearly needs some love - and we -very- badly need some sensible
idle priorities system adding to VCL to get better quality rendering and
better work scheduling :-)
ATB,
Michael.
--
michael.meeks at suse.com <><, Pseudo Engineer, itinerant idiot
More information about the LibreOffice
mailing list