[gnome-builder/wip/chergert/headerbar] build-result: avoid timeout when in main thread



commit d219067b1c5ab583f6937cb9ab5ad964a65d15c8
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jun 22 18:27:48 2016 -0700

    build-result: avoid timeout when in main thread

 libide/buildsystem/ide-build-result.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/libide/buildsystem/ide-build-result.c b/libide/buildsystem/ide-build-result.c
index b31fc1f..e7521b4 100644
--- a/libide/buildsystem/ide-build-result.c
+++ b/libide/buildsystem/ide-build-result.c
@@ -708,6 +708,13 @@ ide_build_result_emit_diagnostic (IdeBuildResult *self,
   g_return_if_fail (IDE_IS_BUILD_RESULT (self));
   g_return_if_fail (diagnostic != NULL);
 
+  /* Emit immediately if we are in the primary thread. */
+  if G_LIKELY (g_main_context_get_thread_default () == g_main_context_default ())
+    {
+      g_signal_emit (self, signals [DIAGNOSTIC], 0, diagnostic);
+      return;
+    }
+
   pair = g_slice_alloc0 (sizeof *pair);
   pair->result = g_object_ref (self);
   pair->diagnostic = ide_diagnostic_ref (diagnostic);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]