This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gregory.p.smith
Recipients gregory.p.smith
Date 2008-06-20.23:23:24
SpamBayes Score 0.0032411779
Marked as misclassified No
Message-id <1214004207.53.0.484694251636.issue3155@psf.upfronthosting.co.za>
In-reply-to
Content
Currently the threading module has loops in it such as
threading.Condition.wait's loop that attempts to acquire a lock in
non-blocking mode and if it fails, sleeps for a while and trys again. 
(with exponential backoff of sleep time from 500us to 50ms in the
current implementation).

This is inefficient.

Perhaps pthread_cond_timedwait does the same thing internally in some
implementations but even if so, it will do it a lot more efficiently
than doing it in python.

We should expose a PyThread_acquire_lock API that accepts a timeout and
uses pthread_cond_timedwait (or the equivalent on other OSes) when
available.

caveats?  This may alter behavior with regards to KeyboardInterrupt
exceptions coming in being processed or not depending on the particular
OS timedwait implementation.
History
Date User Action Args
2008-06-20 23:23:28gregory.p.smithsetspambayes_score: 0.00324118 -> 0.0032411779
recipients: + gregory.p.smith
2008-06-20 23:23:27gregory.p.smithsetspambayes_score: 0.00324118 -> 0.00324118
messageid: <1214004207.53.0.484694251636.issue3155@psf.upfronthosting.co.za>
2008-06-20 23:23:26gregory.p.smithlinkissue3155 messages
2008-06-20 23:23:24gregory.p.smithcreate