]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Set QoS priority class for the main thread when running from launchd.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 27 Sep 2018 16:01:33 +0000 (12:01 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Thu, 27 Sep 2018 16:01:33 +0000 (12:01 -0400)
scheduler/main.c

index e9d98720b98babd6c438f96c8f2a2a5acae6e425..4b3914ade50409b38a1cd40819cd08850cc98085 100644 (file)
@@ -17,6 +17,7 @@
 #include <sys/resource.h>
 #ifdef __APPLE__
 #  include <xpc/xpc.h>
+#  include <pthread/qos.h>
 #endif /* __APPLE__ */
 #ifdef HAVE_ASL_H
 #  include <asl.h>
@@ -1926,6 +1927,14 @@ service_checkin(void)
               count;                        /* Number of listeners */
     int       *ld_sockets;                  /* Listener sockets */
 
+#  ifdef __APPLE__
+   /*
+    * Force "user initiated" priority for the main thread...
+    */
+
+    pthread_set_qos_class_self_np(QOS_CLASS_USER_INITIATED, 0);
+#  endif /* __APPLE__ */
+
    /*
     * Check-in with launchd...
     */