➜

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 eryksun
Recipients Kevin Shweh, SnoopJeDi, bjs, eryksun, pitrou, serhiy.storchaka, tim.peters, vstinner
Date 2022-02-13.09:23:52
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <[email protected]>
In-reply-to
Content
> 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.
History
Date User Action Args
2022-02-13 09:23:52eryksunsetrecipients: + eryksun, tim.peters, pitrou, vstinner, serhiy.storchaka, Kevin Shweh, bjs, SnoopJeDi
2022-02-13 09:23:52eryksunsetmessageid: <[email protected]>
2022-02-13 09:23:52eryksunlinkissue46726 messages
2022-02-13 09:23:52eryksuncreate