码迷,mamicode.com
首页 > 编程语言 > 详细

gevent的线程池

时间:2016-10-31 22:39:15      阅读:357      评论:0      收藏:0      [点我收藏+]

标签:gevent

import time
import gevent
from gevent.threadpool import ThreadPool


pool = ThreadPool(6)
start = time.time()
for _ in range(12):
    pool.spawn(time.sleep, 1)
gevent.wait()
delay = time.time() - start
print(‘Running "time.sleep(1)" 4 times with 3 threads. Should take about 2 seconds: %.3fs‘ % delay)

本文出自 “大荒芜经” 博客,请务必保留此出处http://2892931976.blog.51cto.com/5396534/1867706

gevent的线程池

标签:gevent

原文地址:http://2892931976.blog.51cto.com/5396534/1867706

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!