[gst-devel] Possible race-condition when using g_enum_register_static

Michal Benes michal.benes at itonis.tv
Thu Oct 18 12:46:42 CEST 2007


Thank you Tim and Jan for explaining me the issue.

> > The problem is that the code like this is quite common in GStreamer.
> > Am I wrong or is this a real problem?
> 
> I am not sure whether this really is a problem in practice, since these
> _get_type() functions will first be called from within the plugin_init
> function when the plugin is loaded and the element is registered [*],
> and the plugin loading is serialised.

So my problem is actually a bug in GstMad which references
GstMadEmphasis only on _chain function. The easy solution is to
reference this type in class_init (plugin_init is located in another
source file and it does not have access to GstMadEmphasis API). I will
create a bug with patch for this.

Still a similar problem might be in other plugins and it would be very
painful to check all GType initializations. It also seems to be
maintenance nightmare. I will also look at the GOnce construct and how
it could be used to solve this.

	Michal





More information about the gstreamer-devel mailing list