08 进程池同步方法

import time
from multiprocessing import Process,Pool


def f1(n):
    time.sleep(1)
    # print(n)
    return n*n

if __name__ == '__main__':

    pool = Pool(4)

    for i in range(10):
        print('xxxxxx')
        res = pool.apply(f1,args=(i,))
        print(res)

  

posted on 2019-01-14 15:34  =.===  阅读(80)  评论(0编辑  收藏  举报

导航