04-16-2014 09:36 PM
I was wondering if the consumer loop in a producer consumer architecture only works when the producer loop sends something to it, or is it always working, even if it doesn't receive anything from the producer loop?
Solved! Go to Solution.
04-17-2014 12:39 AM
It depends on how you have it set up. If you don't have a timeout on the dequeue, it will sleep until it gets a message. If you ahve a timeout, it will execute if the timeout value is reached.
04-17-2014 07:03 AM
In a "pure" producer/consumer, there is no timeout on the queue. So as long as there is no data waiting in the queue, the Dequeue Element will "sleep" until the is data available.
As Greg stated, if you have a timeout, then the Dequeue Element will "sleep" until the timeout is reached (assuming no data is available during the timeout time). There is an output of the Dequeue Element that will tell you if it did timeout. This is sometimes useful if you want to pull an instrument every so often or keep an ethernet port active. But that is getting more into the Queued Message Handler than a Producer/Consumer.