[gjs] context: Fix usage of g_idle_add for resolving promises



commit 9389a7eb5e66ae30648c4e822cb55581663ccf75
Author: Jason Hicks <jaszhix gmail com>
Date:   Thu Sep 14 04:25:02 2017 -0500

    context: Fix usage of g_idle_add for resolving promises
    
    Changed to g_idle_add_full with default priority, not default idle. This
    can add up and unnecessarily inflates the process time for asynchronous
    tasks.
    
    (Patch originally by Jason Hicks, edited for GJS by Philip Chimento)
    
    See #1 for context.

 gjs/context.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/gjs/context.cpp b/gjs/context.cpp
index 433ecc7..a9cdbec 100644
--- a/gjs/context.cpp
+++ b/gjs/context.cpp
@@ -600,7 +600,8 @@ _gjs_context_enqueue_job(GjsContext      *gjs_context,
         return false;
     if (!gjs_context->idle_drain_handler)
         gjs_context->idle_drain_handler =
-            g_idle_add(drain_job_queue_idle_handler, gjs_context);
+            g_idle_add_full(G_PRIORITY_DEFAULT, drain_job_queue_idle_handler,
+                            gjs_context, nullptr);
 
     return true;
 }


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