[Python-Dev] why multiprocessing use os._exit (original) (raw)
Tao Qingyun qingyun.tao at tophant.com
Thu Mar 2 23:51:59 EST 2017
- Previous message (by thread): [Python-Dev] Fwd: Re: Enum conversions in the stdlib
- Next message (by thread): [Python-Dev] why multiprocessing use os._exit
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message (by thread): [Python-Dev] Fwd: Re: Enum conversions in the stdlib
- Next message (by thread): [Python-Dev] why multiprocessing use os._exit
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]