Okay, I was bored tonight, so I cooked up an illustration.

Thanks for that!

Here's an example with five stages.  Stage 1 takes a string and fills an
input queue with a series of letters from the string.  Stages 2-4 do just
take a letter off its input queue and move it to its output queue.  Stage
5 takes a letter off its input queue and then assembles it into the string
and prints it once complete.

I think that I might be missing something in my understanding of python. Between the producer and consumer threads, does the consumer end of the queue sit there and wait for something to come down the queue or is the consumer wake up after a randompause()? Right now, I have the semaphores as gatekeepers to each one of the threads. And until something is in the queue, the thread's semaphore will wait for the semphore to be released by the previous thread.

-Tino


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to