How do I know when the GMainLoop has started running?

Tim-Philipp Müller t.i.m at zen.co.uk
Tue Jun 19 09:06:09 PDT 2012


On Tue, 2012-06-19 at 08:48 -0700, tanmay.ambre wrote:

> I did that used g_main_loop_isrunning to test
> 
> But that means I have to run it in a loop to keep check when it starts
> running.
> 
> I searched on forums for Glib forums and trying to find a better way of
> doing it.

You could attach an idle source (g_idle_source_new() for a custom main
context, g_idle_add() for the default glib main context). When your
callback gets called, the main loop has started running. Return FALSE
from the callback to be called only once (i.e. never again).

Cheers
 -Tim



More information about the gstreamer-devel mailing list