1. Eric Larson
  2. CherryPy

Commits

Rene Peinthor  committed 8be6f27

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 4caaf31
  • Branches default

Comments (0)

Files changed (1)

File cherrypy/process/plugins.py

View file
     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."""