[Python-Dev] Interrupting a thread

Tim Peters tim_one@email.msn.com
Wed, 14 Jul 1999 11:53:46 -0400


[Tim sez there's no portable way to violate another thread "even in C"]

[Mark Hammond]
> Nope - not if I forget Python.  However, when I restrict myself _to_
> Python, I find this nice little ceval.c loop and nice little per-thread
> structures - even with nice-looking exception place-holders ;-)

Good point!  Python does have its own notion of threads.

> Something tells me that it wont be quite as easy as filling these
> in (while you have the lock, of course!), but it certainly seems far
> more plausible than if we consider it a C problem :-)

Adding a scheme that builds on the global lock and Python-controlled thread
switches may not be prudent if your life's goal is to make Python
free-threaded <wink>.

But if "if you can't beat 'em, join 'em" rules the day, making
Py_AddPendingCall thread safe, adding a target thread argument, and fleshing
out the

   XXX Darn!  With the advent of thread state, we should have an array
   of pending calls per thread in the thread state!  Later...

comment before it, could go a long way toward facilitating groping in the
back seat of dad's car <wink>.

cheaper-than-renting-a-motel-room-for-sure-ly y'rs  - tim