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 details)

Uploaded Source

Built Distribution

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

Uploaded Egg

File details

Details for the file thread_pool-0.9.tar.gz.

File metadata

  • Download URL: thread_pool-0.9.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for thread_pool-0.9.tar.gz
Algorithm Hash digest
SHA256 e055db47643eaecf5432837cec2058173f985c600fa0ee58eb7bae58fd34a7dc
MD5 732b8505a0250e53c26b101d7554e436
BLAKE2b-256 740ca25ae9c5b9316f62ae1323ce82f6bac3d071cad713bf7c672a5805404324

See more details on using hashes here.

File details

Details for the file thread_pool-0.9-py2.7.egg.

File metadata

  • Download URL: thread_pool-0.9-py2.7.egg
  • Upload date:
  • Size: 5.2 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for thread_pool-0.9-py2.7.egg
Algorithm Hash digest
SHA256 a5ab81e9577339764f47328af478e5de13e3aa141e79a9b97f7b47afaedabe2a
MD5 8338d457e62310b39dc43509fb216f79
BLAKE2b-256 bb8bd8ba7f9157c48c8375546d99dd0832de601f56f8d32691dab42b308e3739

See more details on using hashes here.

Supported by

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