When to call g_thread_init(), again... and again...

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

When to call g_thread_init(), again... and again...

rohitratri@gmail.com
Hi,

Can somebody explain when exactly the api g_thread_init() should be called? 

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()?

I see that this discussion has already taken place here - http://mail.gnome.org/archives/gtk-devel-list/2008-August/msg00110.html 
but I didn't see a convincing answer/solution being discussed.

Thanks
Rohit

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: When to call g_thread_init(), again... and again...

Rui Tiago Cação Matos
On 4 January 2011 05:52, Rohit Atri <[hidden email]> 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

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel