diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2011-02-25 22:07:43 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2011-02-25 22:07:43 (GMT) |
commit | 0bd4deba383b1c7f05a4e0c94f1d4b96050a1308 (patch) | |
tree | fd95fcfc38af8fceb8e56409f63e4e2bd30e0c52 /Lib/multiprocessing/process.py | |
parent | 4bc685752f9f1056545ab121db833a4a68dd794c (diff) | |
download | cpython-0bd4deba383b1c7f05a4e0c94f1d4b96050a1308.zip cpython-0bd4deba383b1c7f05a4e0c94f1d4b96050a1308.tar.gz cpython-0bd4deba383b1c7f05a4e0c94f1d4b96050a1308.tar.bz2 |
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.
Diffstat (limited to 'Lib/multiprocessing/process.py')
-rw-r--r-- | Lib/multiprocessing/process.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/multiprocessing/process.py b/Lib/multiprocessing/process.py index b56a061..3fb9ff6 100644 --- a/Lib/multiprocessing/process.py +++ b/Lib/multiprocessing/process.py @@ -91,12 +91,16 @@ class Process(object): ''' _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 |