]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
The scheduler was being backgrounded on macOS, causing applications to spin
authorMichael R Sweet <michaelrsweet@gmail.com>
Wed, 18 Jul 2018 03:52:38 +0000 (23:52 -0400)
committerMichael R Sweet <michaelrsweet@gmail.com>
Wed, 18 Jul 2018 03:52:38 +0000 (23:52 -0400)
(rdar://40436080)

scheduler/main.c:
- Start/end transactions on startup/shutdown.

scheduler/sysman.c:
- Remove transactions from cupsdSetBusy.

CHANGES.md
scheduler/main.c
scheduler/org.cups.cupsd.plist
scheduler/sysman.c

index d04c0b92d9ee0755758b8e4ea5d61583a6553a48..482e6f3e346240251c96eb210457be9dd3720056 100644 (file)
@@ -1,4 +1,4 @@
-CHANGES - 2.3b6 - 2018-06-29
+CHANGES - 2.3b6 - 2018-07-17
 ============================
 
 Changes in CUPS v2.3b6
@@ -17,6 +17,8 @@ Changes in CUPS v2.3b6
 - The web interface did not list the IPP Everywhere "driver" (Issue #5338)
 - The scheduler did not report all of the supported job options and values
   (Issue #5340)
+- The scheduler was being backgrounded on macOS, causing applications to spin
+  (rdar://40436080)
 - Authentication in the web interface did not work on macOS (rdar://41444473)
 - Fixed a memory leak for some IPP (extension) syntaxes.
 
index a992b540d12dbe70c8ef44cece43dbd5772de88d..371dce549b055eb448bc634742518b7419c5a83d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Main loop for the CUPS scheduler.
  *
- * Copyright 2007-2017 by Apple Inc.
+ * Copyright 2007-2018 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  * Licensed under Apache License v2.0.  See the file "LICENSE" for more
@@ -15,6 +15,9 @@
 #define _MAIN_C_
 #include "cupsd.h"
 #include <sys/resource.h>
+#ifdef __APPLE__
+#  include <xpc/xpc.h>
+#endif /* __APPLE__ */
 #ifdef HAVE_ASL_H
 #  include <asl.h>
 #elif defined(HAVE_SYSTEMD_SD_JOURNAL_H)
@@ -1954,6 +1957,10 @@ service_checkin(void)
       service_add_listener(ld_sockets[i], (int)i);
 
     free(ld_sockets);
+
+#  ifdef __APPLE__
+    xpc_transaction_begin();
+#  endif /* __APPLE__ */
   }
 
 #elif defined(HAVE_SYSTEMD)
@@ -2092,6 +2099,12 @@ service_checkout(int shutdown)          /* I - Shutting down? */
     else
       cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to create KeepAlive/PID file \"%s\": %s", pidfile, strerror(errno));
   }
+
+
+#  ifdef __APPLE__
+  if (shutdown)
+    xpc_transaction_end();
+#  endif /* __APPLE__ */
 }
 
 
index 8e1d0e96e5e3de295dfc1f2ee3220669576ed3cb..20ff05da7e0735cfeec7acb6100bc6f707a29703 100644 (file)
@@ -8,8 +8,6 @@
        <string>Adaptive</string>
        <key>EnableTransactions</key>
        <true/>
-       <key>EnablePressuredExit</key>
-       <false/>
        <key>ExitTimeOut</key>
        <integer>60</integer>
        <key>KeepAlive</key>
index 8c8cf1cdebc7d32e849875da53c2cbfa60170cbd..e7f79e3dec74fac41a2df553f0c676470e10b869 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * System management functions for the CUPS scheduler.
  *
- * Copyright 2007-2017 by Apple Inc.
+ * Copyright 2007-2018 by Apple Inc.
  * Copyright 2006 by Easy Software Products.
  *
  * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
@@ -14,7 +14,6 @@
 
 #include "cupsd.h"
 #ifdef __APPLE__
-#  include <xpc/xpc.h>
 #  include <IOKit/pwr_mgt/IOPMLib.h>
 #endif /* __APPLE__ */
 
@@ -125,7 +124,6 @@ cupsdSetBusyState(int working)          /* I - Doing significant work? */
     "Active clients, printing jobs, and dirty files"
   };
 #ifdef __APPLE__
-  static int tran = 0; /* Current busy transaction */
   static IOPMAssertionID keep_awake = 0;/* Keep the system awake while printing */
 #endif /* __APPLE__ */
 
@@ -164,23 +162,8 @@ cupsdSetBusyState(int working)          /* I - Doing significant work? */
   */
 
   if (newbusy != busy)
-  {
     busy = newbusy;
 
-#ifdef __APPLE__
-    if (busy && !tran)
-    {
-      xpc_transaction_begin();
-      tran = 1;
-    }
-    else if (!busy && tran)
-    {
-      xpc_transaction_end();
-      tran = 0;
-    }
-#endif /* __APPLE__ */
-  }
-
 #ifdef __APPLE__
   if (cupsArrayCount(PrintingJobs) > 0 && !keep_awake)
   {