Re: Waiting forGMainLoop events



On Wed, 2013-06-26 at 14:32 -0700, Kip Warner wrote:
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:

Hey Bogdan. I just re-read your post and realized you want to not
process the event. In this case, I believe gtk_main_iteration_do() does
process the event if is one to process. If you just want to check if
there are any events at all, without processing them, try
gtk_events_pending().

-- 
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]