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.
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.
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.
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.
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.