static void thread_link_unlink (gpointer data) { THREAD_START (); while (THREAD_TEST_RUNNING ()) { gst_pad_link (src, sink); gst_pad_unlink (src, sink); THREAD_SWITCH (); } }
/* thread function for threaded name change test */ static gpointer thread_name_object (GstObject * object) { gchar *thread_id = g_strdup_printf ("%p", g_thread_self ()); THREAD_START (); /* give main thread a head start */ g_usleep (100000); /* write our name repeatedly */ g_message ("THREAD %s: starting loop\n", thread_id); while (THREAD_TEST_RUNNING ()) { gst_object_set_name (object, thread_id); /* a minimal sleep invokes a thread switch */ THREAD_SWITCH (); } /* thread is done, so let's return */ g_message ("THREAD %s: set name\n", thread_id); g_free (thread_id); return NULL; }