[gnome-builder] build-result: avoid timeout when in main thread



commit 6e216d6816d85d3c0009cd92030ed992ca0eaf63
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]