How to force a thread to stop

Gerhard Fiedler gelists at gmail.com
Wed Jul 26 19:12:17 EDT 2006


On 2006-07-26 17:33:19, Carl J. Van Arsdall wrote:

> Alright, if you read all that, thanks, and thanks for your input. Whether
> or not I've agreed with anything, me and a few colleagues definitely
> discuss each idea as its passed to us.  For that, thanks to the python
> list!

I think you should spend a few hours and read up on realtime OS features
and multitasking programming techniques. Get a bit away from the bottom
level, forget about the specific features of your OS and your language and
try to come up with a set of requirements and a structure that fits them. 

Regarding communicating with a thread (or process, that's about the same,
only the techniques vary), for example -- there are not that many options.
Either the thread/process polls a message queue or it goes to sleep once it
has done whatever it needed to do until something comes in through a queue
or until a semaphore gets set. What is better suited for you depends on
your requirements and overall structure. Both doesn't seem to be too clear.

If you have threads that take too long and need to be killed, then I'd say
fix the code that runs there... 

Gerhard




More information about the Python-list mailing list