[gnome-builder] libide: add short-circuit for property notification
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] libide: add short-circuit for property notification
- Date: Tue, 28 Jun 2016 00:04:37 +0000 (UTC)
commit 1c423af5771a21795a52dac1e46b22c707a31178
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]