Bug#777692: ITP: python-pthreading -- Reimplement threading.Lock, RLock and Condition with libpthr
Package: wnpp
Owner: stirabos <stirabos@redhat.com>
Severity: wishlist
* Package name : python-pthreading
Version : 0.1.3-3
Upstream Author : Dan Kenigsberg <danken@redhat.com> * URL : https://pypi.python.org/pypi/pthreading * License : GNU GPLv2+
Programming Lang: Python
Description : Reimplement threading.Lock, RLock and Condition with libpthr
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.
.
Reply to: