From ea9dd6099adac780d4bcbd7782065456896f8777 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 4 Nov 2005 11:43:10 +0000 Subject: [PATCH] gst/gstbus.c: Get the context to wake up only once. Original commit message from CVS: * gst/gstbus.c: (gst_bus_class_init), (gst_bus_init), (gst_bus_post): Get the context to wake up only once. --- ChangeLog | 6 ++++++ gst/gstbus.c | 15 +++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 700b13503f..db4a09356e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-11-04 Wim Taymans + + * gst/gstbus.c: (gst_bus_class_init), (gst_bus_init), + (gst_bus_post): + Get the context to wake up only once. + 2005-11-03 Wim Taymans * check/states/sinks.c: (GST_START_TEST): diff --git a/gst/gstbus.c b/gst/gstbus.c index 6268ee469c..27127cee5c 100644 --- a/gst/gstbus.c +++ b/gst/gstbus.c @@ -97,6 +97,9 @@ static void gst_bus_get_property (GObject * object, guint prop_id, static GstObjectClass *parent_class = NULL; static guint gst_bus_signals[LAST_SIGNAL] = { 0 }; +/* the context we wakeup when we posted a message on the bus */ +static GMainContext *main_context; + GType gst_bus_get_type (void) { @@ -194,6 +197,8 @@ gst_bus_class_init (GstBusClass * klass) G_SIGNAL_RUN_LAST | G_SIGNAL_DETAILED, G_STRUCT_OFFSET (GstBusClass, message), NULL, NULL, marshal_VOID__MINIOBJECT, G_TYPE_NONE, 1, GST_TYPE_MESSAGE); + + main_context = g_main_context_default (); } static void @@ -203,8 +208,6 @@ gst_bus_init (GstBus * bus) bus->queue_lock = g_mutex_new (); GST_DEBUG_OBJECT (bus, "created"); - - return; } static void @@ -332,8 +335,8 @@ gst_bus_post (GstBus * bus, GstMessage * message) g_mutex_unlock (bus->queue_lock); GST_DEBUG_OBJECT (bus, "[msg %p] pushed on async queue", message); - /* FIXME cannot assume the source is only in the default context */ - g_main_context_wakeup (NULL); + /* FIXME cannot assume sources are only in the default context */ + g_main_context_wakeup (main_context); break; case GST_BUS_ASYNC: @@ -356,8 +359,8 @@ gst_bus_post (GstBus * bus, GstMessage * message) g_queue_push_tail (bus->queue, message); g_mutex_unlock (bus->queue_lock); - /* FIXME cannot assume the source is only in the default context */ - g_main_context_wakeup (NULL); + /* FIXME cannot assume sources are only in the default context */ + g_main_context_wakeup (main_context); /* now block till the message is freed */ g_cond_wait (cond, lock);