How to force a thread to stop

H J van Rooyen mail at microcorp.co.za
Fri Jul 28 02:27:18 EDT 2006


"Dennis Lee Bieber" <wlfraed at ix.netcom.com> Wrote:

| On Thu, 27 Jul 2006 08:48:37 -0400, Jean-Paul Calderone
| <exarkun at divmod.com> declaimed the following in comp.lang.python:
|
| >
| > If a thread never performs any I/O operations, signal handlers will still
| > get invokes on the arrival of a signal.
| >
| I thought I'd qualified that scenario -- from the point of view of
| one OS I've programmed, where signals were only handled as part of the
| I/O system (or, in more general, as part of any /blocking/ system call
| from an application -- not even a <ctrl-c> would have an effect unless
| the application invoked a blocking call, or explicitly polled the signal
| bits of its task header)
| --

I have to support this - a processor is only doing one instruction at a time, if
its not a multi core device - and the only ways that the "operating system part"
of the system can get control back from the *user program part* of the system
are:

a) when the User makes an OS call (like blocking I/O, or any OS request)
b) when the user code is interrupted by some hardware thingy and the OS part
handles the interrupt.

So on a processor that does not have protected instructions - if an idiot writes
something to the following effect :

*instructions to disable interrupts*

followed by :

*instructions that go into an infinite loop AND that make no OS calls*

the whole bang shoot stops dead - Reset your machine...

Dennis - did your OS not have a ticker running?

- Hendrik





More information about the Python-list mailing list