Author pitrou
Recipients gps, pitrou
Date 2009-11-13.17:31:38
SpamBayes Score 1.99937e-10
Marked as misclassified No
Message-id <>
Here is a patch which adds a timeout feature to the locking operations
provided by Python. This feature is added at two levels:
- the C API level, with a new function PyThread_acquire_lock_timed()
- the Python level, with an optional `timeout` argument to the acquire()
method of Lock and RLock objects (it also helps simplify the wait()
function of Condition objects)

The timeout duration is expressed in microseconds at the C API level,
and in seconds at the Python API level. There is also a new Python-level
constant, `_thread.TIMEOUT_MAX`, indicating the max allowable timeout
value (values above this raise an OverflowError).

At the C level, the max timeout is PY_TIMEOUT_MAX (in microseconds). The
caller should check the value him/herself.

The patch contains both a POSIX implementation and a Windows
implementation. It still lacks docs.
Date User Action Args
2009-11-13 17:31:48pitrousetrecipients: + pitrou, gps
2009-11-13 17:31:48pitrousetmessageid: <>
2009-11-13 17:31:47pitroulinkissue7316 messages
2009-11-13 17:31:46pitroucreate