#!env python3
# -*- coding:utf-8 -*-
# Author: simonzhang.net
import time
from multiprocessing import Pool
def toPrint(n):
print(n, int(time.time()))
time.slee(0.5)
if __name__=='__main__':
# 系统有20个CPU
p = Pool(20)
# 加载数据
for i in range(60):
p.apply_async(toPrint, args=(i,))
# 加载完成开始执行
p.close()
p.join()
发表评论