Commits

Rene Peinthor committed 2b6a0e8

Python3.3 doesn't use setdaemon for initializing the daemon var anymore
So BackgroundTask would always use the current threads daemon mode on py3.3

  • Participants
  • Parent commits daf9bb4
  • Branches cherrypy-3.2.x

Comments (0)

Files changed (1)

cherrypy/process/plugins.py

     it won't delay stopping the whole process.
     """
 
-    def __init__(self, interval, function, args=[], kwargs={}, bus=None):
+    def __init__(self, interval, function, args=[], kwargs={}, bus=None, *, daemon=True):
         threading.Thread.__init__(self)
         self.interval = interval
         self.function = function
         self.kwargs = kwargs
         self.running = False
         self.bus = bus
+        if daemon is not None:
+            self.daemon = daemon
+        else:
+            self.daemon = current_thread().daemon
 
     def cancel(self):
         self.running = False
                 # Quit on first error to avoid massive logs.
                 raise
 
-    def _set_daemon(self):
-        return True
-
 
 class Monitor(SimplePlugin):
     """WSPBus listener to periodically run a callback in its own thread."""