[glib/glib-2-20] Use io_prio as mainloop prio for async-emulation (#579449)



commit 00547ece56ac781c2f0c438773627e175e89c65a
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Jun 18 19:43:46 2009 +0200

    Use io_prio as mainloop prio for async-emulation (#579449)
    
    I'm not sure why we used the elaborate formula to convert the io-priority
    to the priority of the mainloop idle when emulating async i/o with idles.
    However, it causes the default io priority to be less than the normal
    idle prio, so the i/o won't be scheduled if there is an idle outstanding.
    
    There is really no great mapping to use here, doing blocking i/o in an
    idle of any prio is generally bad and apps doing a lot of async i/o should
    initialize threads. However, if we use the io-priority directly we at least
    avoid the starvation problem above and make things easier to understand.

 gio/gioscheduler.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gio/gioscheduler.c b/gio/gioscheduler.c
index 14b59fe..8d97a56 100644
--- a/gio/gioscheduler.c
+++ b/gio/gioscheduler.c
@@ -257,7 +257,7 @@ g_io_scheduler_push_job (GIOSchedulerJobFunc  job_func,
       /* Threads not available, instead do the i/o sync inside a
        * low prio idle handler
        */
-      job->idle_tag = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE + 1 + io_priority / 10,
+      job->idle_tag = g_idle_add_full (io_priority,
 				       run_job_at_idle,
 				       job, job_destroy);
     }



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