Re: Injecting an exception into another thread

Hi! Sorry for the delay, I didn't realize I needed to be subscribed to the mailing list to participate in conversations. My use case is that I have a gui application which runs arbitrary tasks as background threads, and needs to provide a cancel button to interrupt them. The tasks are often legacy code and/or are very difficult to find reasonable points to insert checks for interruption. Another use case would be implementing a python shell in a gui. If you want to maintain responsiveness while commands execute, they must be able to run in another thread (or another process, but this is not ideal if the shell is supposed to interact with the internals of your application). Interrupting lines with ctrl-c requires being able to send an exception to worker threads. Hope this helps! Thanks, - Audrey

Hi Audrey, right, that makes sense. I've opened an issue: https://foss.heptapod.net/pypy/pypy/-/issues/3757 In case you want to get involved, it's probably not that hard to implement and I'd be happy to guide you through it. Let me know! Cheers, Carl Friedrich On 31.05.22 08:57, Audrey Dutcher wrote:

Hi Audrey, hi all, it's almost a year later and the feature has actually been there since a while and I forgot to write you about it. In case it's still relevant for you: You can now interrupt other threads like this: __pypy__.thread._raise_in_thread(thread_id, ExceptionClass) Cheers, CF On 31/05/2022 14:26, Carl Friedrich Bolz-Tereick wrote:

Hi Audrey, right, that makes sense. I've opened an issue: https://foss.heptapod.net/pypy/pypy/-/issues/3757 In case you want to get involved, it's probably not that hard to implement and I'd be happy to guide you through it. Let me know! Cheers, Carl Friedrich On 31.05.22 08:57, Audrey Dutcher wrote:

Hi Audrey, hi all, it's almost a year later and the feature has actually been there since a while and I forgot to write you about it. In case it's still relevant for you: You can now interrupt other threads like this: __pypy__.thread._raise_in_thread(thread_id, ExceptionClass) Cheers, CF On 31/05/2022 14:26, Carl Friedrich Bolz-Tereick wrote:
participants (3)
-
Audrey Dutcher
-
Carl Friedrich Bolz-Tereick
-
CF Bolz-Tereick