diff Lib/multiprocessing/process.py @ 68155:f71acc4b2341

Issue #6064: Add a `daemon` keyword argument to the threading.Thread and multiprocessing.Process constructors in order to override the default behaviour of inheriting the daemonic property from the current thread/process.
author Antoine Pitrou <solipsis@pitrou.net>
date Fri, 25 Feb 2011 22:07:43 +0000
parents b084b50e4aa6
children 568a3ba088e4
line wrap: on
line diff
--- a/Lib/multiprocessing/process.py	Fri Feb 25 21:46:01 2011 +0000
+++ b/Lib/multiprocessing/process.py	Fri Feb 25 22:07:43 2011 +0000
@@ -91,12 +91,16 @@
     '''
     _Popen = None
 
-    def __init__(self, group=None, target=None, name=None, args=(), kwargs={}):
+    def __init__(self, group=None, target=None, name=None, args=(), kwargs={},
+                 *, daemon=None):
         assert group is None, 'group argument must be None for now'
         count = next(_current_process._counter)
         self._identity = _current_process._identity + (count,)
         self._authkey = _current_process._authkey
-        self._daemonic = _current_process._daemonic
+        if daemon is not None:
+            self._daemonic = daemon
+        else:
+            self._daemonic = _current_process._daemonic
         self._tempdir = _current_process._tempdir
         self._parent_pid = os.getpid()
         self._popen = None