[gst-devel] When to call g_thread_init(), again... and again...

Rui Tiago Cação Matos tiagomatos at gmail.com
Tue Jan 4 13:01:24 CET 2011


On 4 January 2011 05:52, Rohit Atri <rohitratri at gmail.com> wrote:
> Can somebody explain when exactly the api g_thread_init() should be called?

Only if you would like to provide glib with a GThreadFunctions[1]
other than the default.

> And does a "threaded" program exactly mean(in the context of the
> documentation here
>http://library.gnome.org/devel/glib/2.26/glib-Threads.html#g-thread-init)?
> If I've a gst pipeline which obviously runs in a different thread from my
> application thread, should I be calling g_thread_init()?

As documented there:

"Please note that since version 2.24 the GObject initialization
function g_type_init() initializes threads (with a NULL argument), so
most applications, including those using Gtk+ will run with threads
enabled."

Since GStreamer builds upon the GType system[2] it initializes GType
and thus also the glib threading stuff when you call gst_init().

Rui

[1] http://library.gnome.org/devel/glib/2.26/glib-Threads.html#GThreadFunctions
[2] http://library.gnome.org/devel/gobject/2.26/gobject-Type-Information.html




More information about the gstreamer-devel mailing list