gst: Delay creation of threadpools
authorEdward Hervey <edward@centricular.com>
Fri, 12 Jun 2020 13:07:42 +0000 (15:07 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Tue, 16 Jun 2020 06:23:21 +0000 (08:23 +0200)
commit31e6d766ff7e6b9a524797012058eff0e312443c
tree4cfd6490b86a1d786e7980871598258bce07f937
parent9d195da36ce67d23e712515a8adaf91e5a3ee1d1
gst: Delay creation of threadpools

Since glib 2.64, gthreadpool will start waiting on a GCond immediately upon
creation. This can cause issues if we fork *before* actually using the
threadpool since we will then be signalling that GCond ... from another process
and that will never work.

Instead, delay creationg of thread pools until the very first time we need
them. This introduces a minor (un-noticeable) delay when needing a new thread
but fixes the issues for all users of GSTreamer that will call gst_init, then
fork and actually start pipelines.

See https://gitlab.gnome.org/GNOME/glib/-/issues/2131 for more context.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/531>
gst/gstelement.c
gst/gsttask.c