Implements thread pool with queue module of python.
Project description
Thread pool
This is a simple thread pool for python(using queue module).
Usage
Firstly, you should define a callback to deal with your task:
def do_work(*args, **kwds): # do something
Then, you can create a thread pool to schedule your tasks:
from thread_pool import ThreadPool # Create thread pool with nums threads pool = ThreadPool(nums) # Add a task into pool pool.add_task(do_work, args, kwds) # Join and destroy all threads pool.destroy()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
thread_pool-0.9.tar.gz
(3.1 kB
view hashes)
Built Distribution
thread_pool-0.9-py2.7.egg
(5.2 kB
view hashes)