killing thread ?
Paul Rubin
phr-n2003b at NOSPAMnightsong.com
Fri Jan 24 11:03:34 EST 2003
More information about the Python-list mailing list
Fri Jan 24 11:03:34 EST 2003
- Previous message (by thread): killing thread ?
- Next message (by thread): killing thread ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Martin v. Löwis" <martin at v.loewis.de> writes: > Python does not implement a thread switching code; these are > operating system threads. > > If you are thinking that the interpreter loop could look whether it > shall terminate: this works only if the thread is not in a blocking > system call. How does this sound: The interpreter loop can check whether there's a kill pending for any other threads (that's just looking at a flag that will be false almost all the time). If there's a kill pending, the interpreter sends a signal to the target thread. That should unblock any blocked i/o. A global signal handler then raises an exception in the target thread which gets handled the usual way. That does leave the target thread able to catch the exception and keep looping. Even still, it improves on the present situation. I can imagine some ways to hair up the exception mechanism to stop that from happening, but that starts to mess with exception semantics rather deeply.
- Previous message (by thread): killing thread ?
- Next message (by thread): killing thread ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list