multiprocessing - Blocking subprocess function in Python? -
i had asynchronous function being called this:
from multiprocessing import process def my_function(arg1, arg2): print 'long process begins' p = process(target=my_function, args=(arg1, arg2,)).start() how can make blocking? need finish process before running rest of script.
use p.join()
block calling thread until process join() method called terminates or until optional timeout occurs.
if timeout none there no timeout.
a process can joined many times.
a process cannot join because cause deadlock. error attempt join process before has been started.
Comments
Post a Comment