Message413174
> is there a bulletproof way to guarantee that `self._stop()` gets
> called if the acquire_and_release() succeeds?
I don't think it's critical. But we still should deal with the common case in Windows in which a KeyboardInterrupt is raised immediately after the method returns. For example:
try:
if lock.acquire_and_release(block, timeout):
self._stop
except:
if not lock.locked():
self._stop()
The proposed acquire_and_release() method can also be used in threading._shutdown(), when it iterates _shutdown_locks to join non-daemon threads. |
|
| Date |
User |
Action |
Args |
| 2022-02-13 09:23:52 | eryksun | set | recipients:
+ eryksun, tim.peters, pitrou, vstinner, serhiy.storchaka, Kevin Shweh, bjs, SnoopJeDi |
| 2022-02-13 09:23:52 | eryksun | set | messageid: <[email protected]> |
| 2022-02-13 09:23:52 | eryksun | link | issue46726 messages |
| 2022-02-13 09:23:52 | eryksun | create | |
|