[issue18966] Threads within multiprocessing Process terminate early

Antoine Pitrou report at bugs.python.org
Thu Jul 14 02:42:06 EDT 2016


Antoine Pitrou added the comment:

I agree with Tim. Regardless of what OS threads do, Python tries to enforce predictable semantics of its own. There's no reason (apart from historical baggage) to not join Python threads (and only Python threads, of course, not other OS threads) at the shutdown of a child process.

I don't exactly remember why using os._exit() rather than sys.exit() is required in child processes. Presumably it is because we don't want the child to clobber any resources shared with the parent (open files?). This doesn't have to be a binary thing, though: it may as well be os._exit() + a bunch of cleanup steps we know are safe to perform.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18966>
_______________________________________


More information about the Python-bugs-list mailing list