pythonthreadpool - A Python ThreadPool Implementation - Google Project Hosting
2012-05-03 15:13
537 查看
pythonthreadpool - A Python ThreadPool Implementation - Google Project Hosting
The API has three important functions:
max_workers is the maximum number of threads used in/by the pool.
kill_workers_after is the number of seconds a worker should wait for jobs before being killed
args is a list of arguments to the function
return_callback is called when the function has been performed.
wait_for_workers_period is the number of seconds to wait for workers to shutdown
clean_shutdown_reties how many times to retry the shutdown
the method returns True if the shutdown was succesfull.
ThreadPool Component
The ThreadPool is a component in which other components can get jobs executed.The API has three important functions:
ThreadPool(max_workers=5, kill_workers_after=3)
Constructor functionmax_workers is the maximum number of threads used in/by the pool.
kill_workers_after is the number of seconds a worker should wait for jobs before being killed
add_job(function, args=None, return_callback=None)
function is the callable that defines the jobargs is a list of arguments to the function
return_callback is called when the function has been performed.
shutdown(wait_for_workers_period = 1, clean_shutdown_reties = 5)
Blocks so no more jobs are accepted. Waits for all workers to punch out. When a call to this function returns the program can be terminated.wait_for_workers_period is the number of seconds to wait for workers to shutdown
clean_shutdown_reties how many times to retry the shutdown
the method returns True if the shutdown was succesfull.
相关文章推荐
- greecket - a python not block socket module base the greenlet and thread - Google Project Hosting
- 浅谈python 线程池threadpool之实现
- python线程池(threadpool)模块使用python2.7
- python线程池threadpool使用篇
- python线程池(threadpool)模块使用
- python threadpool使用注意事项
- Python 线程池(threadpool)
- python线程池(threadpool)模块使用
- python 线程池threadpool(使用篇)
- threadpool——python线程池
- Python中利用Threadpool.map()多线程抓数据
- python threadpool
- python线程池threadpool实现篇
- python线程池(threadpool)模块使用笔记
- python threadpool 源码分析以及自己封装的简易版线程池
- python 添加 threadpool
- python线程池(threadpool)模块使用
- Thread pool in python
- python threadpool 多参数处理
- python 线程池threadpool之实现