Skip to main content

like the standard threading module, but awesomer

Project description

threading2: like the standard threading module, but awesomer.

This module is designed as a drop-in replacement and extension for the default “threading” module. It has two main objectives:

  • implement primitives using native platform functionality where possible

  • expose more sophisticated functionality where it can be done uniformly

The following extensions are currently implemented:

  • ability to set (advisory) thread priority

  • ability to set (advisory) CPU affinity at thread and process level

  • thread groups for simultaneous management of multiple threads

  • SHLock class for shared/exclusive (also known as read/write) locks

The following API niceties are also included:

  • all blocking methods take a “timeout” argument and return a success code

  • all exposed objects are actual classes and can be safely subclassed

This has currently only been tested on WinXP and Ubuntu Karmic; similar platforms should work OK, and other platforms should fall back to using sensible default behaviour, but I’m not making any guarantees at this stage.

Additional planned extensions include:

  • make stack_size a kwarg when creating a thread

  • native events, semaphores and timed waits on win32

  • native conditions and timed waits on pthreads platforms

Stuff that might get included one day:

  • ReadWriteLock (using SRW on Win Vista+, pthread_rwlock on posix)

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

threading2-0.2.0.tar.gz (19.3 kB view details)

Uploaded Source

File details

Details for the file threading2-0.2.0.tar.gz.

File metadata

  • Download URL: threading2-0.2.0.tar.gz
  • Upload date:
  • Size: 19.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for threading2-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ba234b4f39cb27b819aefc92e66fc017a0e29484277cfe6b2cb42116b7dede45
MD5 4338a89572f04e12d8cb59d912f66ecb
BLAKE2b-256 655f0d0e4a3d605d3f0baf5d74e121c02df7e9b71c3e07a9bce5c0129dea49f7

See more details on using hashes here.

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