From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Producer consumer architecture functionality

Solved!
Go to solution

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?

0 Kudos
Message 1 of 3
(2,263 Views)
Solution
Accepted by topic author Fernan1988

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.

Message 2 of 3
(2,241 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 3
(2,210 Views)