LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What happens if you do not poll a queue

I have a different classes that I integrate into different applications. Some of this classes write into a Queue data to be logged but in some applications this is not needed. Is there any penalty for writting into a queue and not polling out the data? What happens to the memory?

Thanks,

Hernan
0 Kudos
Message 1 of 6
(2,993 Views)
Hi Hernan,
i´m not really sure what you mean. You don´t need to poll a queue, you can use the "dequeue element" function with "-1" as timeout. It means that you wait til an event occurs. If you only write into a queue and don´t read from it, the memory usage will increase. See the shipped example, search for queue in the example finder.
 
Hope it helps.
Mike
0 Kudos
Message 2 of 6
(2,991 Views)
Thanks for the answer Mike. By polling I meant dequeing. The issue is that in some classes I have a queue that I use in some applications, but not in others. I could add a boolean to the class to determine if it should write to the queue, but if there is not penalty for queing without dequieng will make things easier.
(i.e. If I can set a limit of memory to use so when is reached that the queue will automatically delete older elements)

Regards,

Hernan
0 Kudos
Message 3 of 6
(2,988 Views)
Hi Hernan,
you can set the size of the queue.
Mike
0 Kudos
Message 4 of 6
(2,985 Views)
Herman, Mike,

Setting the size of a queue does not do exactly what Herman asked. When the queue is full any attempt to enqueue another element will wait until the timeout and then return a timeout indication. To make a circular buffer from a finite sized queue, you need to add a wrapper VI which detects the enqueue timeout as an indication that the buffer is full, dequeues one element and discards it, then enqueues the new element.

Lynn
0 Kudos
Message 5 of 6
(2,962 Views)
Thanks for the info!

Hernan
0 Kudos
Message 6 of 6
(2,948 Views)