[gnome-software/gnome-3-30] lib: set long-running plugin workers threads to idle IO priority



commit dff179ee816c22fbc04443121dd1f3a0ab73b65f
Author: Robert McQueen <rob endlessm com>
Date:   Fri Sep 7 14:11:52 2018 +0100

    lib: set long-running plugin workers threads to idle IO priority
    
    Use the newly-added gs_ioprio_init() function for the plugin tasks which are
    run on threads from our worker pool. This allows us to succinctly set all
    potentially IO-intensive long-running operations (install, update, etc) to this
    priority as these are run in the pool. Interactive tasks such as refreshes etc
    are unaffected as their GTasks are run on new threads. This also means we don't
    need to worry about restoring the thread priorities, as we know all threads in
    this pool will not be re-used for any other workload.

 lib/gs-plugin-loader.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index e26b8531..7da60d87 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -31,6 +31,7 @@
 #include "gs-app-private.h"
 #include "gs-app-list-private.h"
 #include "gs-category-private.h"
+#include "gs-ioprio.h"
 #include "gs-plugin-loader.h"
 #include "gs-plugin.h"
 #include "gs-plugin-event.h"
@@ -3453,6 +3454,8 @@ gs_plugin_loader_process_in_thread_pool_cb (gpointer data,
        gpointer task_data = g_task_get_task_data (task);
        GCancellable *cancellable = g_task_get_cancellable (task);
 
+       gs_ioprio_init ();
+
        gs_plugin_loader_process_thread_cb (task, source_object, task_data, cancellable);
        g_object_unref (task);
 }


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