Lock objects should only be shared between processes through inheritance
python的进程同步需要使用multiprocessing.Manager类型的对象来构造,普通的Lock不行
def main(): iterable = [1, 2, 3, 4, 5] pool = multiprocessing.Pool() m = multiprocessing.Manager() l = m.Lock() func = partial(target, l) pool.map(func, iterable) pool.close() pool.join()