Lazy g_main_loop()

Mark Doliner mark at kingant.net
Thu Sep 20 11:29:09 EDT 2007


On Thu, 20 Sep 2007 17:31:35 +0300, Kyryll A Mirnenko aka Mirya wrote
> I'm trying to integrate the libpurple (actually for its AIM 
> implementation) with a multithreaded frontend. There's one strange 
> problem i'm observing: the frontend tries to send a message, so it 
> passes the "task" a a callback to the main loop like this:
> 
> g_idle_add_full(G_PRIORITY_DEFAULT, (GSourceFunc)sendMessageCb, data,
>  NULL);
> 
> sendMessageCb simply sends it via the libpurple; the problem is it 
> takes a long time for this callback to be executed, so i get this: 1)
>  after g_idle_add_full() it takes up to 30 seconds to enter the sendMessageCb
> 2) if some external input is being done (there's no GUI in my case,
>  so it's only about some network event to libpurple) the 
> sendMessageCb is processed immediately - looks like external input 
> works as a catalyst 3) setting the first argument to G_PRIORITY_HIGH 
> gives nothing - the effect is the same 4) after g_idle_add_full() is 
> called and before sendMessageCb is entered there's no debug log from 
> libpurple 5) the only account activated (online) is an AIM one 6)
>  Linux, FC5, 2.6 kernel, glibc 2.4, glib 2.10.3
> 
> So the question is: where those 30 sec go and how to eliminate this gap?

(Resending to all...)

Why don't you just use g_timeout_add(0, (GSourceFunc)sendMessageCb, data)?

-Mark




More information about the Devel mailing list