I wrote the following code
import multiprocessing as mp
import time
#
def f(x) :
time.sleep(0.1)
return pow( x, 2 )
#
my_chunksize = 10
#
if __name__ == '__main__':
#
po = mp.Pool( processes=2 )
po_res = po.map_async( f, range(100), my_chunksize )
#po.close()
#po.join()
#
print po_res.get()
This is working fine. Why are the po.close()
and po.join()
unneeded? Why doesn't the main process die before the children processes?