Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Reimplement threading.Lock, RLock and Condition with libpthread

Project Description

Reimplement threading.Lock, RLock and Condition with libpthread

The pthreading module provides Lock and Condition synchronization objects compatible with Python native threading module. The implementation, however, is based on POSIX thread library as delivered by the libpthread. Lock and Condition are designed to be a drop-in replacement for their respective threading counterpart.

Take a look at threading.py of Python 2. Notice that Event.wait() wakes 20 times a second and checks if the event has been set. This CPU hogging has been fixed in Python 3, but is not expected to change during Python 2 lifetime.

To avoid this waste of resources, put in your main module:

import pthreading
pthreading monkey_patch()

This would hack the Linux-native threading module, and make it use Linux-native POSIX synchronization objects.

The pthreading code was originally written as part of Vdsm by Cyril Plisko, Saggi Mizrahi and others. For questions, comments and patches please contact vdsm-devel.

Release History

This version
History Node

0.1.3-3

History Node

0.1.3

History Node

0.1.2

History Node

0.1.1

History Node

0.1.0

Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
pthreading-0.1.3-3.tar.gz
(3.7 kB) Copy SHA256 Hash SHA256
Source None Jul 29, 2014

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting