[Tutor] threading

Terry Carroll carroll at tjc.com
Wed Aug 16 20:43:35 CEST 2006


On Tue, 15 Aug 2006, Jeff Peery wrote:

> hello, how do I stop a thread? 

In all the threaded apps I have so far, I've worked with Queues to give 
them work.  So my technique has been to put a special-purpose element on 
the Queue, which is recognized by the thread, which exits.

I usually have multiple threads accessing the Queue (or what's the 
point?), so before exiting, the ending thread requeues the "stop" element 
back onto the Queue it took it from, so that other executing threads can 
pick it up and process it the same way.



More information about the Tutor mailing list