+ GST_OBJECT_LOCK (task);
+ }
+ task->priv->enter_func = enter_func;
+ task->priv->enter_user_data = user_data;
+ task->priv->enter_notify = notify;
+ GST_OBJECT_UNLOCK (task);
+}
+
+/**
+ * gst_task_set_leave_callback:
+ * @task: The #GstTask to use
+ * @leave_func: (in): a #GstTaskThreadFunc
+ * @user_data: user data passed to @leave_func
+ * @notify: called when @user_data is no longer referenced
+ *
+ * Call @leave_func when the task function of @task is left. @user_data will
+ * be passed to @leave_func and @notify will be called when @user_data is no
+ * longer referenced.
+ */
+void
+gst_task_set_leave_callback (GstTask * task, GstTaskThreadFunc leave_func,
+ gpointer user_data, GDestroyNotify notify)
+{
+ GDestroyNotify old_notify;
+
+ g_return_if_fail (task != NULL);
+ g_return_if_fail (GST_IS_TASK (task));
+
+ GST_OBJECT_LOCK (task);
+ if ((old_notify = task->priv->leave_notify)) {
+ gpointer old_data = task->priv->leave_user_data;
+
+ task->priv->leave_user_data = NULL;
+ task->priv->leave_notify = NULL;