[Python-Dev] Interrupting a thread

Tim Peters tim_one@email.msn.com
Wed, 14 Jul 1999 02:35:31 -0400


[Mark Hammond]
> Ive struck this a number of times, and the simple question is "can we
> make it possible to interrupt a thread without the thread's knowledge"
> or otherwise stated "how can we asynchronously raise an exception in
> another thread?"

I don't think there's any portable way to do this.  Even restricting the
scope to Windows, forget Python for a moment:  can you do this reliably with
NT threads from C, availing yourself of every trick in the SDK?  Not that I
know of; not without crafting a new protocol that the targeted threads agree
to in advance.

> ...
> But-sounds-pretty-easy-under-those-fake-threads<wink>-ly,

Yes, piece o' cake!  Fake threads can do anything, because unless we write
every stick of their implementation they can't do anything at all <wink>.

odd-how-solutions-create-more-problems-than-they-solve-ly y'rs  - tim