04-17-2014 01:34 PM
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!
Solved! Go to Solution.
04-17-2014 01:52 PM
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.
04-17-2014 02:18 PM
What should I set to -1, so that the Dequeue, waits forever until it receives something new?
04-17-2014 02:26 PM
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.
04-17-2014 02:31 PM
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.
04-17-2014 02:44 PM
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.