[pypy-dev] Re: Injecting an exception into another thread

2023-05-10 Thread CF Bolz-Tereick
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

[pypy-dev] Re: Injecting an exception into another thread

2022-05-31 Thread Carl Friedrich Bolz-Tereick
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

[pypy-dev] Re: Injecting an exception into another thread

2022-05-31 Thread Audrey Dutcher
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

[pypy-dev] Re: Injecting an exception into another thread

2022-05-27 Thread Carl Friedrich Bolz-Tereick
Hi Audrey, Welcome! Thanks for your question! So PyPy has the internal functionality to asynchronous signals at safepoints. We use it for example to call __del__ methods of collected objects at safe positions, for signals, and also to implement _thread.interrupt_main. The mechanism in PyPy is a