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 | RSS feed

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.

Source Distribution

thread_pool-0.9.tar.gz (3.1 kB view hashes)

Uploaded Source

Built Distribution

thread_pool-0.9-py2.7.egg (5.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page