Skip to main content

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

This version

0.9

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for thread_pool, version 0.9
Filename, size File type Python version Upload date Hashes
Filename, size thread_pool-0.9-py2.7.egg (5.2 kB) File type Egg Python version 2.7 Upload date Hashes View hashes
Filename, size thread_pool-0.9.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page