Hello Kip, Thank you for the answer. Unfortunately this will not help. If the method "Runs a single iteration of the mainloop" as stated in the documentation it's not OK - I won't be able to lock the mutex. By the way, if I correctly understand the documentation the g_main_context_iteration( GMainContext *context, gboolean may_block );that I plan to use has also the possibility to block if no events are pending. What I need is waiting for an event, without executing it. with best regards, bogdan On 6/26/2013 23:32, 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, bogdanHey 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, |