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 vstinner
Recipients neologix, pitrou, vstinner
Date 2017-06-26.13:50:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The current code of PyThread_acquire_lock_timed() (the implementation not using semaphore) doesn't compute correctly the timeout when pthread_cond_timedwait() is interrupted by a signal. We should recompute the timeout using a deadline.

Something like

if (tvp)
    deadline = _PyTime_GetMonotonicClock() + timeout;

do {
    ... use tvp
    if (errno != EINTR)

    /* select() was interrupted by a signal */
    if (PyErr_CheckSignals())
        goto finally;

    if (tvp) {
        timeout = deadline - _PyTime_GetMonotonicClock();
        if (timeout < 0) {
            n = 0;
        _PyTime_AsTimeval_noraise(timeout, &tv, _PyTime_ROUND_CEILING);
        /* retry select() with the recomputed timeout */
} while (1);
Date User Action Args
2017-06-26 13:50:01vstinnersetrecipients: + vstinner, pitrou, neologix
2017-06-26 13:50:01vstinnersetmessageid: <>
2017-06-26 13:50:01vstinnerlinkissue30768 messages
2017-06-26 13:50:01vstinnercreate