concurrentCalculation.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:Learning-Concurrency-in-Python 作者: PacktPublishing 项目源码 文件源码
def main():
  print("Starting number crunching")
  t0 = time.time()

  procs = []

  # Here we create our processes and kick them off
  for i in range(10):
    proc = Process(target=executeProc, args=())
    procs.append(proc)
    proc.start()

  # Again we use the .join() method in order to wait for 
  # execution to finish for all of our processes
  for proc in procs:
    proc.join()

  t1 = time.time()
  totalTime = t1 - t0
  # we print out the total execution time for our 10
  # procs.
  print("Execution Time: {}".format(totalTime))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号