2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
5 * gstthread.c: Threaded container object
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
25 /* #define GST_DEBUG_ENABLED */
26 #include "gst_private.h"
29 #include "gstthread.h"
30 #include "gstscheduler.h"
33 #define STACK_SIZE 0x200000
35 #define g_thread_equal(a,b) ((a) == (b))
37 GstElementDetails gst_thread_details = {
41 "Container that creates/manages a thread",
43 "Erik Walthinsen <omega@cse.ogi.edu>",
48 /* Thread signals and args */
69 static void gst_thread_class_init (GstThreadClass *klass);
70 static void gst_thread_init (GstThread *thread);
72 static void gst_thread_dispose (GObject *object);
74 static void gst_thread_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
75 static void gst_thread_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
77 static GstElementStateReturn gst_thread_change_state (GstElement *element);
79 #ifndef GST_DISABLE_LOADSAVE
80 static xmlNodePtr gst_thread_save_thyself (GstObject *object, xmlNodePtr parent);
81 static void gst_thread_restore_thyself (GstObject *object, xmlNodePtr self);
84 static void* gst_thread_main_loop (void *arg);
86 #define GST_TYPE_THREAD_SCHEDPOLICY (gst_thread_schedpolicy_get_type())
88 gst_thread_schedpolicy_get_type(void) {
89 static GType thread_schedpolicy_type = 0;
90 static GEnumValue thread_schedpolicy[] = {
91 {G_THREAD_PRIORITY_LOW, "LOW", "Low Priority Scheduling"},
92 {G_THREAD_PRIORITY_NORMAL, "NORMAL", "Normal Scheduling"},
93 {G_THREAD_PRIORITY_HIGH, "HIGH", "High Priority Scheduling"},
94 {G_THREAD_PRIORITY_URGENT, "URGENT", "Urgent Scheduling"},
97 if (!thread_schedpolicy_type) {
98 thread_schedpolicy_type = g_enum_register_static("GstThreadSchedPolicy", thread_schedpolicy);
100 return thread_schedpolicy_type;
103 static GstBinClass *parent_class = NULL;
104 static guint gst_thread_signals[LAST_SIGNAL] = { 0 };
107 gst_thread_get_type(void) {
108 static GType thread_type = 0;
111 static const GTypeInfo thread_info = {
112 sizeof(GstThreadClass),
115 (GClassInitFunc)gst_thread_class_init,
120 (GInstanceInitFunc)gst_thread_init,
123 thread_type = g_type_register_static(GST_TYPE_BIN, "GstThread", &thread_info, 0);
129 gst_thread_class_init (GstThreadClass *klass)
131 GObjectClass *gobject_class;
132 GstObjectClass *gstobject_class;
133 GstElementClass *gstelement_class;
134 GstBinClass *gstbin_class;
136 gobject_class = (GObjectClass*)klass;
137 gstobject_class = (GstObjectClass*)klass;
138 gstelement_class = (GstElementClass*)klass;
139 gstbin_class = (GstBinClass*)klass;
141 parent_class = g_type_class_ref (GST_TYPE_BIN);
143 g_object_class_install_property(G_OBJECT_CLASS (klass), ARG_SCHEDPOLICY,
144 g_param_spec_enum("schedpolicy", "Scheduling Policy", "The scheduling policy of the thread",
145 GST_TYPE_THREAD_SCHEDPOLICY, G_THREAD_PRIORITY_NORMAL, G_PARAM_READWRITE));
146 g_object_class_install_property(G_OBJECT_CLASS (klass), ARG_PRIORITY,
147 g_param_spec_int("priority", "Scheduling Priority", "The scheduling priority of the thread",
148 0, 99, 0, G_PARAM_READWRITE));
150 gst_thread_signals[SHUTDOWN] =
151 g_signal_new ("shutdown", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
152 G_STRUCT_OFFSET (GstThreadClass, shutdown), NULL, NULL,
153 gst_marshal_VOID__VOID, G_TYPE_NONE, 0);
155 gobject_class->dispose = gst_thread_dispose;
157 #ifndef GST_DISABLE_LOADSAVE
158 gstobject_class->save_thyself = GST_DEBUG_FUNCPTR (gst_thread_save_thyself);
159 gstobject_class->restore_thyself = GST_DEBUG_FUNCPTR (gst_thread_restore_thyself);
162 gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_thread_change_state);
164 gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_thread_set_property);
165 gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_thread_get_property);
170 gst_thread_init (GstThread *thread)
172 GstScheduler *scheduler;
174 GST_DEBUG (GST_CAT_THREAD, "initializing thread");
176 /* threads are managing bins and iterate themselves */
177 /* CR1: the GstBin code checks these flags */
178 GST_FLAG_SET (thread, GST_BIN_FLAG_MANAGER);
179 GST_FLAG_SET (thread, GST_BIN_SELF_SCHEDULABLE);
181 scheduler = gst_scheduler_factory_make (NULL, GST_ELEMENT (thread));
183 thread->lock = g_mutex_new ();
184 thread->cond = g_cond_new ();
186 thread->ppid = getpid ();
187 thread->thread_id = (GThread *) NULL;
188 thread->sched_policy = G_THREAD_PRIORITY_NORMAL;
189 thread->priority = 0;
190 thread->stack = NULL;
194 gst_thread_dispose (GObject *object)
196 GstThread *thread = GST_THREAD (object);
198 GST_DEBUG (GST_CAT_REFCOUNTING, "dispose");
200 g_mutex_free (thread->lock);
201 g_cond_free (thread->cond);
203 G_OBJECT_CLASS (parent_class)->dispose (object);
205 if (GST_ELEMENT_SCHED (thread)) {
206 gst_object_unref (GST_OBJECT (GST_ELEMENT_SCHED (thread)));
211 gst_thread_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
215 /* it's not null if we got it, but it might not be ours */
216 g_return_if_fail (GST_IS_THREAD (object));
218 thread = GST_THREAD (object);
221 case ARG_SCHEDPOLICY:
222 thread->sched_policy = g_value_get_enum (value);
225 thread->priority = g_value_get_int (value);
228 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
234 gst_thread_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
238 /* it's not null if we got it, but it might not be ours */
239 g_return_if_fail (GST_IS_THREAD (object));
241 thread = GST_THREAD (object);
244 case ARG_SCHEDPOLICY:
245 g_value_set_enum (value, thread->sched_policy);
248 g_value_set_int (value, thread->priority);
251 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
259 * @name: the name of the thread
261 * Create a new thread with the given name.
263 * Returns: The new thread
266 gst_thread_new (const gchar *name)
268 return gst_element_factory_make ("thread", name);
271 /* these two macros are used for debug/info from the state_change function */
273 #define THR_INFO(format,args...) \
274 GST_INFO_ELEMENT(GST_CAT_THREAD, thread, "sync(" GST_DEBUG_THREAD_FORMAT "): " format , \
275 GST_DEBUG_THREAD_ARGS(thread->pid) , ## args )
277 #define THR_DEBUG(format,args...) \
278 GST_DEBUG_ELEMENT(GST_CAT_THREAD, thread, "sync(" GST_DEBUG_THREAD_FORMAT "): " format , \
279 GST_DEBUG_THREAD_ARGS(thread->pid) , ## args )
281 /* these two macros are used for debug/info from the gst_thread_main_loop
285 #define THR_INFO_MAIN(format,args...) \
286 GST_INFO_ELEMENT(GST_CAT_THREAD, thread, "sync-main(" GST_DEBUG_THREAD_FORMAT "): " format , \
287 GST_DEBUG_THREAD_ARGS(thread->ppid) , ## args )
289 #define THR_DEBUG_MAIN(format,args...) \
290 GST_DEBUG_ELEMENT(GST_CAT_THREAD, thread, "sync-main(" GST_DEBUG_THREAD_FORMAT "): " format , \
291 GST_DEBUG_THREAD_ARGS(thread->ppid) , ## args )
293 static GstElementStateReturn
294 gst_thread_update_state (GstThread *thread)
296 GST_DEBUG_ELEMENT (GST_CAT_THREAD, thread, "updating state of thread");
297 /* check for state change */
298 if (GST_STATE_PENDING (thread) != GST_STATE_VOID_PENDING) {
299 /* punt and change state on all the children */
300 if (GST_ELEMENT_CLASS (parent_class)->change_state)
301 return GST_ELEMENT_CLASS (parent_class)->change_state (GST_ELEMENT (thread));
304 /* FIXME: in the case of no change_state function in the parent's class,
305 * shouldn't we actually change the thread's state ? */
306 g_warning ("thread's parent doesn't have change_state, returning success");
307 return GST_STATE_SUCCESS;
311 static GstElementStateReturn
312 gst_thread_change_state (GstElement * element)
315 gboolean stateset = GST_STATE_SUCCESS;
317 GThread * self = g_thread_self ();
318 GError * error = NULL;
320 g_return_val_if_fail (GST_IS_THREAD (element), GST_STATE_FAILURE);
321 g_return_val_if_fail (gst_has_threads (), GST_STATE_FAILURE);
323 thread = GST_THREAD (element);
325 transition = GST_STATE_TRANSITION (element);
327 THR_INFO ("changing state from %s to %s",
328 gst_element_state_get_name (GST_STATE (element)),
329 gst_element_state_get_name (GST_STATE_PENDING (element)));
331 if (g_thread_equal (self, thread->thread_id)) {
332 GST_DEBUG (GST_CAT_THREAD,
333 "no sync(" GST_DEBUG_THREAD_FORMAT "): setting own thread's state to spinning",
334 GST_DEBUG_THREAD_ARGS (thread->pid));
335 return gst_thread_update_state (thread);
338 switch (transition) {
339 case GST_STATE_NULL_TO_READY:
340 /* set the state to idle */
341 GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
343 THR_DEBUG ("creating thread \"%s\"", GST_ELEMENT_NAME (element));
345 /* this bit of code handles creation of GThreads
346 * this is therefor tricky code
347 * compare it with the block of code that handles the destruction
348 * in GST_STATE_READY_TO_NULL below
350 g_mutex_lock (thread->lock);
352 /* create a new GThread
353 * use the specified attributes
354 * make it execute gst_thread_main_loop (thread)
356 GST_DEBUG (GST_CAT_THREAD, "going to g_thread_create_full...");
357 thread->thread_id = g_thread_create_full(gst_thread_main_loop,
358 thread, STACK_SIZE, TRUE, TRUE, G_THREAD_PRIORITY_NORMAL,
360 if (!thread->thread_id){
361 GST_DEBUG (GST_CAT_THREAD, "g_thread_create_full failed");
362 g_mutex_unlock (thread->lock);
363 GST_DEBUG (GST_CAT_THREAD, "could not create thread \"%s\"",
364 GST_ELEMENT_NAME (element));
365 return GST_STATE_FAILURE;
367 GST_DEBUG (GST_CAT_THREAD, "GThread created");
369 /* wait for it to 'spin up' */
370 THR_DEBUG ("waiting for child thread spinup");
371 g_cond_wait (thread->cond, thread->lock);
372 THR_DEBUG ("thread claims to be up");
373 g_mutex_unlock (thread->lock);
375 case GST_STATE_READY_TO_PAUSED:
376 THR_INFO ("readying thread");
377 g_mutex_lock (thread->lock);
378 THR_DEBUG ("signaling");
379 g_cond_signal (thread->cond);
380 THR_DEBUG ("waiting for ack");
381 g_cond_wait (thread->cond, thread->lock);
382 THR_DEBUG ("got ack");
383 g_mutex_unlock (thread->lock);
385 case GST_STATE_PAUSED_TO_PLAYING:
387 /* fixme: recurse into sub-bins */
388 const GList *elements = gst_bin_get_list (GST_BIN (thread));
390 gst_element_enable_threadsafe_properties ((GstElement*)elements->data);
391 elements = g_list_next (elements);
394 THR_DEBUG ("telling thread to start spinning");
395 g_mutex_lock (thread->lock);
396 THR_DEBUG ("signaling");
397 g_cond_signal (thread->cond);
398 THR_DEBUG ("waiting for ack");
399 g_cond_wait (thread->cond, thread->lock);
400 THR_DEBUG ("got ack");
401 g_mutex_unlock (thread->lock);
404 case GST_STATE_PLAYING_TO_PAUSED:
406 const GList *elements = (GList *) gst_bin_get_list (GST_BIN (thread));
408 THR_INFO ("pausing thread");
410 /* the following code ensures that the bottom half of thread will run
411 * to perform each elements' change_state() (by calling gstbin.c::
413 * + the pending state was already set by gstelement.c::set_state()
414 * + unlock all elements so the bottom half can start the state change.
416 g_mutex_lock (thread->lock);
418 GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
421 GstElement *element = GST_ELEMENT (elements->data);
426 THR_DEBUG (" waking element \"%s\"", GST_ELEMENT_NAME (element));
427 elements = g_list_next (elements);
429 if (!gst_element_release_locks (element)) {
430 g_warning ("element %s could not release locks", GST_ELEMENT_NAME (element));
433 pads = GST_ELEMENT_PADS (element);
436 GstRealPad *peer = NULL;
437 GstElement *peerelement;
439 if (GST_PAD_PEER (pads->data))
440 peer = GST_REAL_PAD (GST_PAD_PEER (pads->data));
442 pads = g_list_next (pads);
447 peerelement = GST_PAD_PARENT (peer);
449 continue; /* deal with case where there's no peer */
451 if (!GST_FLAG_IS_SET (peerelement, GST_ELEMENT_DECOUPLED)) {
452 GST_DEBUG (GST_CAT_THREAD, "peer element isn't DECOUPLED");
456 if (GST_ELEMENT_SCHED (peerelement) != GST_ELEMENT_SCHED (thread)) {
457 THR_DEBUG (" element \"%s\" has pad cross sched boundary", GST_ELEMENT_NAME (element));
458 THR_DEBUG (" waking element \"%s\"", GST_ELEMENT_NAME (peerelement));
459 if (!gst_element_release_locks (peerelement)) {
460 g_warning ("element %s could not release locks", GST_ELEMENT_NAME (peerelement));
466 THR_DEBUG ("telling thread to pause, signaling");
467 g_cond_signal (thread->cond);
468 THR_DEBUG ("waiting for ack");
469 g_cond_wait (thread->cond, thread->lock);
470 THR_DEBUG ("got ack");
471 g_mutex_unlock (thread->lock);
473 elements = gst_bin_get_list (GST_BIN (thread));
475 gst_element_disable_threadsafe_properties ((GstElement*)elements->data);
476 elements = g_list_next (elements);
480 case GST_STATE_READY_TO_NULL:
481 THR_DEBUG ("telling thread to pause (null) - and joining");
482 /* MattH FIXME revisit */
483 g_mutex_lock (thread->lock);
484 THR_DEBUG ("signaling");
485 g_cond_signal (thread->cond);
486 THR_DEBUG ("waiting for ack");
487 g_cond_wait (thread->cond, thread->lock);
488 THR_DEBUG ("got ack");
490 /* this block of code is very tricky
491 * basically, we try to clean up the whole thread and
492 * everything related to it in the right order without
493 * triggering segfaults
494 * compare this block to the block
497 GST_DEBUG (GST_CAT_THREAD, "joining GThread %p", thread->thread_id);
498 g_thread_join (thread->thread_id);
500 thread->thread_id = NULL;
501 thread->stack = NULL;
503 THR_DEBUG ("unlocking mutex");
504 g_mutex_unlock (thread->lock);
506 GST_FLAG_UNSET (thread, GST_THREAD_STATE_REAPING);
507 GST_FLAG_UNSET (thread, GST_THREAD_STATE_STARTED);
508 GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
511 case GST_STATE_PAUSED_TO_READY:
512 THR_DEBUG ("telling thread to stop spinning");
513 g_mutex_lock (thread->lock);
514 THR_DEBUG ("signaling");
515 g_cond_signal (thread->cond);
516 THR_DEBUG ("waiting for ack");
517 g_cond_wait (thread->cond, thread->lock);
518 THR_DEBUG ("got ack");
519 g_mutex_unlock (thread->lock);
523 GST_DEBUG_ELEMENT (GST_CAT_THREAD, element, "UNHANDLED STATE CHANGE! %x", transition);
531 * gst_thread_main_loop:
532 * @arg: the thread to start
534 * The main loop of the thread. The thread will iterate
535 * while the state is GST_THREAD_STATE_SPINNING.
538 gst_thread_main_loop (void *arg)
540 GstThread *thread = NULL;
543 gpointer stack_pointer;
546 GST_DEBUG (GST_CAT_THREAD, "gst_thread_main_loop started");
547 thread = GST_THREAD (arg);
548 g_mutex_lock (thread->lock);
550 /* set up the element's scheduler */
551 gst_scheduler_setup (GST_ELEMENT_SCHED (thread));
552 GST_FLAG_UNSET (thread, GST_THREAD_STATE_REAPING);
554 thread->pid = getpid();
555 THR_INFO_MAIN ("thread is running");
557 page_size = sysconf(_SC_PAGESIZE);
558 stack_pointer = (gpointer) &stack_pointer;
560 if(((gulong)stack_pointer & (page_size-1)) < (page_size>>1)){
561 /* stack grows up, I think */
562 /* FIXME this is probably not true for the main thread */
563 stack_offset = (gulong)stack_pointer & (page_size - 1);
565 /* stack grows down, I think */
566 stack_offset = STACK_SIZE - ((gulong)stack_pointer & (page_size - 1));
568 /* note the subtlety with pointer arithmetic */
569 thread->stack = stack_pointer - stack_offset;
570 thread->stack_size = STACK_SIZE;
572 /* first we need to change the state of all the children */
573 if (GST_ELEMENT_CLASS (parent_class)->change_state) {
574 stateset = GST_ELEMENT_CLASS (parent_class)->change_state (GST_ELEMENT(thread));
576 if (stateset != GST_STATE_SUCCESS) {
577 THR_DEBUG_MAIN ("state change of children failed");
581 THR_DEBUG_MAIN ("indicating spinup");
582 g_cond_signal (thread->cond);
583 /* don't unlock the mutex because we hold it into the top of the while loop */
584 THR_DEBUG_MAIN ("thread has indicated spinup to parent process");
586 /***** THREAD IS NOW IN READY STATE *****/
588 /* CR1: most of this code is handshaking */
589 /* do this while the thread lives */
590 while (!GST_FLAG_IS_SET (thread, GST_THREAD_STATE_REAPING)) {
591 /* NOTE we hold the thread lock at this point */
592 /* what we do depends on what state we're in */
593 switch (GST_STATE (thread)) {
594 /* NOTE: cannot be in NULL, we're not running in that state at all */
595 case GST_STATE_READY:
596 /* wait to be set to either the NULL or PAUSED states */
597 THR_DEBUG_MAIN ("thread in %s state, waiting for either %s or %s",
598 gst_element_state_get_name (GST_STATE_READY),
599 gst_element_state_get_name (GST_STATE_NULL),
600 gst_element_state_get_name (GST_STATE_PAUSED));
601 g_cond_wait (thread->cond, thread->lock);
603 /* this must have happened by a state change in the thread context */
604 if (GST_STATE_PENDING (thread) != GST_STATE_NULL &&
605 GST_STATE_PENDING (thread) != GST_STATE_PAUSED) {
606 g_cond_signal (thread->cond);
610 /* been signaled, we need to state transition now and signal back */
611 gst_thread_update_state (thread);
612 THR_DEBUG_MAIN ("done with state transition, "
613 "signaling back to parent process");
614 g_cond_signal (thread->cond);
615 /* now we decide what to do next */
616 if (GST_STATE (thread) == GST_STATE_NULL) {
617 /* REAPING must be set, we can simply break this iteration */
618 THR_DEBUG_MAIN ("set GST_THREAD_STATE_REAPING");
619 GST_FLAG_SET (thread, GST_THREAD_STATE_REAPING);
623 case GST_STATE_PAUSED:
624 /* wait to be set to either the READY or PLAYING states */
625 THR_DEBUG_MAIN ("thread in %s state, waiting for either %s or %s",
626 gst_element_state_get_name (GST_STATE_PAUSED),
627 gst_element_state_get_name (GST_STATE_READY),
628 gst_element_state_get_name (GST_STATE_PLAYING));
629 g_cond_wait (thread->cond, thread->lock);
631 /* this must have happened by a state change in the thread context */
632 if (GST_STATE_PENDING (thread) != GST_STATE_READY &&
633 GST_STATE_PENDING (thread) != GST_STATE_PLAYING) {
634 g_cond_signal (thread->cond);
638 /* been signaled, we need to state transition now and signal back */
639 gst_thread_update_state (thread);
640 /* now we decide what to do next */
641 if (GST_STATE (thread) != GST_STATE_PLAYING) {
642 /* either READY or the state change failed for some reason */
643 g_cond_signal (thread->cond);
647 GST_FLAG_SET (thread, GST_THREAD_STATE_SPINNING);
648 /* PLAYING is coming up, so we can now start spinning */
649 while (GST_FLAG_IS_SET (thread, GST_THREAD_STATE_SPINNING)) {
652 g_cond_signal (thread->cond);
653 g_mutex_unlock (thread->lock);
654 status = gst_bin_iterate (GST_BIN (thread));
655 g_mutex_lock (thread->lock);
656 /* g_cond_signal(thread->cond); */
658 if (!status || GST_STATE_PENDING (thread) != GST_STATE_VOID_PENDING)
659 GST_FLAG_UNSET (thread, GST_THREAD_STATE_SPINNING);
661 /* looks like we were stopped because of a statechange */
662 if (GST_STATE_PENDING (thread)) {
663 gst_thread_update_state (thread);
665 /* once we're here, SPINNING has stopped, we should signal that we're done */
666 THR_DEBUG_MAIN ("SPINNING stopped, signaling back to parent process");
667 g_cond_signal (thread->cond);
668 /* now we can wait for PAUSED */
671 case GST_STATE_PLAYING:
672 /* wait to be set to PAUSED */
673 THR_DEBUG_MAIN ("thread in %s state, waiting for %s",
674 gst_element_state_get_name (GST_STATE_PLAYING),
675 gst_element_state_get_name (GST_STATE_PAUSED));
676 g_cond_wait (thread->cond,thread->lock);
678 /* been signaled, we need to state transition now and signal back */
679 gst_thread_update_state (thread);
680 g_cond_signal (thread->cond);
681 /* now we decide what to do next */
682 /* there's only PAUSED, we we just wait for it */
685 THR_DEBUG_MAIN ("thread in %s state, preparing to die",
686 gst_element_state_get_name (GST_STATE_NULL));
687 GST_FLAG_SET (thread, GST_THREAD_STATE_REAPING);
690 g_assert_not_reached ();
695 /* THREAD HAS STOPPED RUNNING */
697 /* we need to destroy the scheduler here because it has mapped it's
698 * stack into the threads stack space */
699 gst_scheduler_reset (GST_ELEMENT_SCHED (thread));
701 /* since we don't unlock at the end of the while loop, do it here */
702 g_mutex_unlock (thread->lock);
704 GST_INFO (GST_CAT_THREAD, "gstthread: thread \"%s\" is stopped",
705 GST_ELEMENT_NAME (thread));
707 g_signal_emit (G_OBJECT (thread), gst_thread_signals[SHUTDOWN], 0);
712 #ifndef GST_DISABLE_LOADSAVE
714 gst_thread_save_thyself (GstObject *object,
717 if (GST_OBJECT_CLASS (parent_class)->save_thyself)
718 GST_OBJECT_CLASS (parent_class)->save_thyself (object, self);
723 gst_thread_restore_thyself (GstObject *object,
726 GST_DEBUG (GST_CAT_THREAD,"gstthread: restore");
728 if (GST_OBJECT_CLASS (parent_class)->restore_thyself)
729 GST_OBJECT_CLASS (parent_class)->restore_thyself (object, self);
731 #endif /* GST_DISABLE_LOADSAVE */