mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 17:50:36 +00:00
GstTask: hook up enter/leave/notify callbacks
Hoop up the notify/enter/leave callbacks.
This commit is contained in:
parent
657c689b7f
commit
d68a20906a
1 changed files with 17 additions and 0 deletions
|
@ -125,9 +125,15 @@ static void
|
|||
gst_task_finalize (GObject * object)
|
||||
{
|
||||
GstTask *task = GST_TASK (object);
|
||||
GstTaskPrivate *priv = task->priv;
|
||||
|
||||
GST_DEBUG ("task %p finalize", task);
|
||||
|
||||
if (priv->thr_notify)
|
||||
priv->thr_notify (priv->thr_user_data);
|
||||
priv->thr_notify = NULL;
|
||||
priv->thr_user_data = NULL;
|
||||
|
||||
/* task thread cannot be running here since it holds a ref
|
||||
* to the task so that the finalize could not have happened */
|
||||
g_cond_free (task->cond);
|
||||
|
@ -141,6 +147,9 @@ gst_task_func (GstTask * task, GstTaskClass * tclass)
|
|||
{
|
||||
GStaticRecMutex *lock;
|
||||
GThread *tself;
|
||||
GstTaskPrivate *priv;
|
||||
|
||||
priv = task->priv;
|
||||
|
||||
tself = g_thread_self ();
|
||||
|
||||
|
@ -158,6 +167,10 @@ gst_task_func (GstTask * task, GstTaskClass * tclass)
|
|||
task->abidata.ABI.thread = tself;
|
||||
GST_OBJECT_UNLOCK (task);
|
||||
|
||||
/* fire the enter_thread callback when we need to */
|
||||
if (priv->thr_callbacks.enter_thread)
|
||||
priv->thr_callbacks.enter_thread (task, tself, priv->thr_user_data);
|
||||
|
||||
/* locking order is TASK_LOCK, LOCK */
|
||||
g_static_rec_mutex_lock (lock);
|
||||
GST_OBJECT_LOCK (task);
|
||||
|
@ -205,6 +218,10 @@ exit:
|
|||
GST_TASK_SIGNAL (task);
|
||||
GST_OBJECT_UNLOCK (task);
|
||||
|
||||
/* fire the leave_thread callback when we need to */
|
||||
if (priv->thr_callbacks.leave_thread)
|
||||
priv->thr_callbacks.leave_thread (task, tself, priv->thr_user_data);
|
||||
|
||||
GST_DEBUG ("Exit task %p, thread %p", task, g_thread_self ());
|
||||
|
||||
gst_object_unref (task);
|
||||
|
|
Loading…
Reference in a new issue