[Python-Dev] why multiprocessing use os._exit
Oleg Broytman
phd at phdru.name
Fri Mar 3 07:24:11 EST 2017
More information about the Python-Dev mailing list
Fri Mar 3 07:24:11 EST 2017
- Previous message (by thread): [Python-Dev] why multiprocessing use os._exit
- Next message (by thread): [Python-Dev] Summary of Python tracker Issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello. This mailing list is to work on developing Python (adding new features to Python itself and fixing bugs); if you're having problems learning, understanding or using Python, please find another forum. Probably python-list/comp.lang.python mailing list/news group is the best place; there are Python developers who participate in it; you may get a faster, and probably more complete, answer there. See http://www.python.org/community/ for other lists/news groups/fora. Thank you for understanding. Using os._exit() after fork is documented: https://docs.python.org/3/library/os.html#os._exit and this is exactly what multiprocessing does. On Fri, Mar 03, 2017 at 12:51:59PM +0800, Tao Qingyun <qingyun.tao at tophant.com> wrote: > in multiprocessing/forking.py#129, `os._exit` cause child process don't close open > file. For example: > > ``` > from multiprocessing import Process > > def f(): > global log # prevent gc close the file > log = open("info.log", "w") > log.write("***hello world***\n") > > p = Process(target=f) > p.start() > p.join() > > ``` > and the `info.log` will be empty. why not use sys.exit ? > > > Thanks Oleg. -- Oleg Broytman http://phdru.name/ phd at phdru.name Programmers don't die, they just GOSUB without RETURN.
- Previous message (by thread): [Python-Dev] why multiprocessing use os._exit
- Next message (by thread): [Python-Dev] Summary of Python tracker Issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list