Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


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@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@suse.com  <><, Pseudo Engineer, itinerant idiot


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.