import os
from multiprocessing import Pool,Process
def f1(n):
print('进程池里面的进程id',os.getpid())
print('>>>>',n)
return n*n
def call_back_func(asdf):
print('>>>>>>>>>>>>>',os.getpid())
print('回调函数中的结果:',asdf)
# print('回调函数中的结果:',s.get())
if __name__ == '__main__':
pool = Pool(4)
res = pool.apply_async(f1,args=(5,),callback=call_back_func)
pool.close()
pool.join()
# print(res.get())
print('主进程的进程id',os.getpid())