LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Consumer trigger in a consumer producer architecture

Solved!
Go to solution

I want to trigger the consumer loop in a consumer producer architecture, so that it can do what it has to do, until it receives something new from the producer loop.

Can someone please tell me how to do this?

Thanks in advance!

0 Kudos
Message 1 of 6
(2,428 Views)

This sounds more like a Master/Slave (which uses notifiers instead of queues).

 

You can set a timeout on the Dequeue Element.  You can use a shift register to change the timeout based on whatever state you need your consumer loop to be.  Use -1 for no timeout, meaning it will wait forever for data to come down the queue.  If you set the timeout to something else, the Dequeue Element waits up to the timeout for data.  If not data comes, it times out and you can do whatever you need from there.


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 2 of 6
(2,423 Views)

What should I set to -1, so that the Dequeue, waits forever until it receives something new?

0 Kudos
Message 3 of 6
(2,410 Views)

There is a timeout input on the queue function.  However, if you want it set to -1, then you don't have to do anything, because the default is -1.

0 Kudos
Message 4 of 6
(2,400 Views)

If I leave the default value of -1, would that force the dequeue to wait for a new value from the queue?

Please correct me if I'm wrong, because this is what I understand.

0 Kudos
Message 5 of 6
(2,396 Views)
Solution
Accepted by Fernan1988

Setting the timeout input of the Dequeue Element to -1 will turn off the timeout.  This mean it will sit there FOREVER until data is available in the queue.


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
Message 6 of 6
(2,390 Views)