LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Get Queue Status (return elements?)

Solved!
Go to solution

Hey everyone, was hoping someone could answer the following: 

In the Get Queue Status, does it Dequeue everything as if it were a Flush Queue thus requiring a TRUE be wired to return elements?  I was told that is not how it works.  If that's not what's meant by "return elements?" then what does that input do?

0 Kudos
Message 1 of 5
(252 Views)
Solution
Accepted by topic author LuminaryKnight

The answer is within reach, with a very small amount of effort:

aputman_0-1776202226410.png

 

aputman
Message 2 of 5
(236 Views)

@aputman wrote:

The answer is within reach, with a very small amount of effort:

aputman_0-1776202226410.png

 


Well, that's on me.  I only read the "return elements?" portion because I wasn't concerned about the other outputs.  But you got to admit, it's worded very poorly and named poorly too.  Anyways, thank you.  Now I understand the naming.

0 Kudos
Message 3 of 5
(191 Views)

@LuminaryKnight wrote:
But you got to admit, it's worded very poorly and named poorly too. 

I disagree.  It's a "Get Status" VI.  If you want the status of the items in the queue, return the elements and examine them.  If you want to flush the queue, you wouldn't use a Get Status VI, you would use the Flush Queue VI (which, by the way, also returns the elements).  I don't see the issue. 

aputman
0 Kudos
Message 4 of 5
(104 Views)

In addition to what aputman writes, you want to be careful about setting the return elements? to true if you are concerned about performance.

 

Queues are in principle high performance elements, when you pass an element to the Enque function it will inherit that element, not create a copy of it (unless of course you branch the incoming wire to something else too that consumes that data as well).

 

Same about Dequeing elements. The element will be removed from the queue and returned without any need to copy its content. With the Get Status function configured to return the elements, the elements can not be cleared from the queue as they are still needed for later dequeing. So this function will need to copy each returned element. This is completely unimportant if your queue element is an integer or other scalar element but starts to get very important if they contain (long) strings or arrays.

 

So beware!

 

I use the Get Status normally only to find out if there is any data in the queue and possibly how many elements, never to peek at the data elements.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 5 of 5
(91 Views)