glib - main event loop



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.

--
Regards
Krzysztof J.



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