Re: Waiting forGMainLoop events



On Wed, 2013-06-26 at 19:02 +0200, Bogdan Lotko wrote:
Hello,

Is it possible to wait for GMainLoop event  without processing them?

the following pseudo-code illustrates the problem:

while( notEndLoop )
{
    waitForEvent();

    lockMutex;

    // Run a single iteration
    g_main_context_iteration( context, false );

   unlockMutex
}

Please note, that I have to lock the mutex before running an iteration.

Thank you for your help

with best regards,

bogdan

Hey Bogdan,

I'm not sure if this is helpful, but take a look at the
gtk_main_iteration_do(gboolean blocking) function, specifically setting
the blocking parameter to false and checking the return. From the
documentation:

        Runs a single iteration of the mainloop. If no events are
        available either return or block depending on the value of
        blocking.
        
                blocking : TRUE if you want GTK+ to block if no events
                are pending
        
                Returns : TRUE if gtk_main_quit() has been called for
                the innermost mainloop

Take care,

-- 
Kip Warner -- Software Engineer
OpenPGP encrypted/signed mail preferred
http://www.thevertigo.com

Attachment: signature.asc
Description: This is a digitally signed message part



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]