[gnome-builder] threading: allow threadpool usage in helper utils



commit b7e0df3e50c5e406a8ab0f6be4878c21da923607
Author: Christian Hergert <chergert redhat com>
Date:   Thu Apr 12 00:24:58 2018 -0700

    threading: allow threadpool usage in helper utils
    
    If we don't have a way to call _ide_thread_pool_init(), it would
    be nice if it still worked.

 src/libide/threading/ide-thread-pool.c | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/src/libide/threading/ide-thread-pool.c b/src/libide/threading/ide-thread-pool.c
index 2d8d4d683..b5d189563 100644
--- a/src/libide/threading/ide-thread-pool.c
+++ b/src/libide/threading/ide-thread-pool.c
@@ -25,6 +25,7 @@
 #include "ide-debug.h"
 
 #include "threading/ide-thread-pool.h"
+#include "threading/ide-thread-private.h"
 
 typedef struct
 {
@@ -70,6 +71,10 @@ enum {
 static inline GThreadPool *
 ide_thread_pool_get_pool (IdeThreadPoolKind kind)
 {
+  /* Fallback to allow using without IdeApplication */
+  if G_UNLIKELY (thread_pools [kind].pool == NULL)
+    _ide_thread_pool_init (TRUE);
+
   return thread_pools [kind].pool;
 }
 


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