[Tutor] Unit testing
carroll at tjc.com
Thu Jun 29 01:47:45 CEST 2006
On Wed, 28 Jun 2006, Tino Dai wrote:
> Ok, I think I'm going to back up and explain what I'm am heading towards.
> I'm working on an app that fire off a bunch of threads. Each one of these
> threads in connected via queues to another thread in a sequence like a
> chain. And how I tell the next stage thread that there is data in the queue
> is via semaphore.
You can just use a series of Queues, where each Queue represents the work
being passed from one thread to the other.
With respect to each Queue, the producing thread places a work unit onto
it with Queue.put; the consumer thread takes a work unit off with
Queue.get(True), so it will wait until there's something in the Queue for
it to do.
And of course, each consumer thread (except the last) is a producer thread
to the next consumer thread.
You could have the parent start up each thread, passing it the Queue from
which it is to read and the Queue to which it is going to write. No
I think you'll find that to be much more straightforward than using
More information about the Tutor