[gnome-builder/wip/chergert/headerbar] libide: add short-circuit for property notification
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/chergert/headerbar] libide: add short-circuit for property notification
- Date: Thu, 23 Jun 2016 00:29:52 +0000 (UTC)
commit 1a6f244e975b6d066269b57111da61b65e70f374
Author: Christian Hergert <chergert redhat com>
Date: Wed Jun 22 17:29:38 2016 -0700
libide: add short-circuit for property notification
libide/ide-object.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-object.c b/libide/ide-object.c
index da347a7..597eafb 100644
--- a/libide/ide-object.c
+++ b/libide/ide-object.c
@@ -607,6 +607,16 @@ ide_object_notify_in_main (gpointer instance,
g_return_if_fail (G_IS_OBJECT (instance));
g_return_if_fail (pspec != NULL);
+ /*
+ * Short circuit if we can notify immediately without the round trip
+ * to the main loop.
+ */
+ if G_LIKELY (g_main_context_get_thread_default () == g_main_context_default ())
+ {
+ g_object_notify_by_pspec (instance, pspec);
+ return;
+ }
+
notify = g_slice_alloc0 (sizeof *notify);
notify->object = g_object_ref (instance);
notify->pspec = g_param_spec_ref (pspec);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]