Skip to main content

Multi-threading library

Project description

ThreadPool library

  • Multi-threading library
  • Allows to limit the number of threads to a fixed number

Install

pip install rythreapool

Usage

  • import the library
import threadpool
  • create a new ThreadPool, giving as argument the number of desidred parallel threads
    • it is suggested to never exceed the number of physical threads that your processor has
pool = threadpool.ThreadPool(16)
  • now it is possible to run multiple functions or tasks
pool.execute(fn=myTask, args=())
  • to check if the threadpool is busy, use the following function
    • returns True if the pool is working, otherwise returns False
pool.isWorking()

Notes

  1. remember that, if a task implements active waiting, it will keep its thread busy until the end of execution
  2. once reaced the limit of parallel threads, all the following tasks will have to wait for a thread to become free

Project details


Download files

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

Source Distribution

rythreadpool-1.0.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rythreadpool-1.0.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file rythreadpool-1.0.0.tar.gz.

File metadata

  • Download URL: rythreadpool-1.0.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.2

File hashes

Hashes for rythreadpool-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0ae3df1a3b6b8bd8c2665ee135049f3503c92f398569643d96e53606fee8fbc7
MD5 c57ad46556cc24f7987872c0a1786d01
BLAKE2b-256 84034fb525d47babca3e0edb267b1d5bc103ad06c6ad414338854bbfe3b00965

See more details on using hashes here.

File details

Details for the file rythreadpool-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: rythreadpool-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.2

File hashes

Hashes for rythreadpool-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2db7623869927f668216d58092887a4569f6557934daf80fa4c6f4e819086a29
MD5 59eeb4aeb9f1f1b456b3df1ba64e05c3
BLAKE2b-256 5f9b8dc034dc53e9931b2730bf77064817abac0df9d1695affbf3d135f667c64

See more details on using hashes here.

Supported by

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