STINNER Victor <victor.stin...@gmail.com> added the comment:

interrupted_lock.py: test threading.Lock.acquire(timeout=1.0) with SIGALRM sent 
every 1 ms (so up to 1000 times in total). Example:

haypo@selma$ ./python interrupted_lock.py 
acquire(timeout=1.0) took 1.0 seconds and got 1000 signals

Oh, in fact, threading.Lock.acquire(timeout=1.0) already recomputes the timeout 
when interrupted.

In Python stdlib, PyThread_acquire_lock_timed() is only called from one place 
with intr_flag=0: faulthandler watchdog thread, but this thread blocks all 
signals:

    /* we don't want to receive any signal */
    sigfillset(&set);
    pthread_sigmask(SIG_SETMASK, &set, NULL);

----------
Added file: https://bugs.python.org/file47233/interrupted_lock.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue30768>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to