02-27-2009 01:39 PM
03-02-2009 10:58 AM
03-02-2009 03:17 PM - edited 03-02-2009 03:18 PM
You shouldn't dqueue from the same queue in two different loops. Only one loop or the other will get any specific value. Think of the queue as an inbox. You can put items in it from anywhere. But if you have more than one person taking items out of the inbox, only one person or the other gets a copy of a paricular item. Whichever person is ready grabs the next item off the top.
If you want two separate while loops for dequeuing information, you should create two queues. The producer loop will put a copy into each queue. Each consumer loop will have its own queue and take items out as they are ready.
The reason the code hangs is that once one dequeue reads the last item in the queue, there is nothing left in that single queue for the other dequeue function to read and be able to move on.
03-03-2009 07:44 AM
03-03-2009 08:40 PM