Re: glib - main event loop



On Tue, 15 Mar 2016 00:00:37 +0100
Krzysztof <kj limes com pl> wrote:
How to get idle event source  called in main event loop? I do the 
following:
my idle function is:

static gboolean
idle ( gpointer data )
{
     g_print ( "Idle called\n" );
     if ( counter1 == 0 && counter2 == 0 )
     {
         g_main_loop_quit ( ( GMainLoop * ) data );
         return FALSE;
     }
     else
         return TRUE;
}

The variables counter1 and counter2 reach 0 after some time of
execution.

I add this source this way:

     g_idle_add ( idle, mlp );

where

     GMainLoop *mlp;

is loop which is run.

Even if all sources end with G_SOURCE_REMOVE the idle source is never 
called.

From your incomplete code it is impossible to say.  Do you call
g_main_loop_run()?  How did you construct your main loop?

Try to post a complete (but minimal) example of what you are doing.

Chris


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