[gst-devel] Possible race-condition when using g_enum_register_static
Jan Schmidt
thaytan at mad.scientist.com
Thu Oct 18 12:18:47 CEST 2007
<quote who="Michal Benes">
> Isn't this racy when two mad plugins in two separate threads call this
> function for the first time? They clearly share the mad_emphasis_type
> variable.
>
> The problem is that the code like this is quite common in GStreamer.
>
> Am I wrong or is this a real problem?
>
Yes, it's an actual problem with the usual idiom for registering GLib types.
Until it is fixed in GLib, we work around it by trying to ensure types get
registered from known single-threaded locations. In this case, a call to the
get_type method in the plugin init or class initialisation for the mad
element should do it.
J.
More information about the gstreamer-devel
mailing list