[Tutor] Threads

R. Alan Monroe amonroe at columbus.rr.com
Tue Nov 16 01:04:06 CET 2004


> On Mon, 15 Nov 2004, Kent Johnson wrote:

>> Terry Carroll wrote:
>>  
>> > I suppose I could [add] that "shutdown element" multiple times, once for 
>> > each consumer thread spawned, but that seems so inelegant.
>>
>> Simple and effective, though, as long as you know how many consumers 
>> there are.

Can your consumers write to the queue? If so, they could bucket brigade
the shutdown element. When the first thread gets the shutdown token,
it eats it and puts a new one on the queue, then shuts down.

Alan



More information about the Tutor mailing list