下边代码段是关于python通过multiprocessing 实现带回调函数的异步调用的代码。
from multiprocessing import Pool
def f(x):
if __name__ == ‘__main__‘:
pool = Pool(processes=1) # Start a worker processes.
result = pool.apply_async(f, [10], callback) # Evaluate "f(10)" asynchronously calling callback when finished.
原文地址:http://blog.51cto.com/14176413/2348696
时间: 2024-11-05 20:38:52