LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Q Reference Count

Solved!
Go to solution

Is there a way to tell how many references to a specific named Q have been allocated?  For instance, if an application uses the Obtain Queue.vi three times to create queue references, I would like to be able to query the number of active queues (for that unique name) that have been created.

Thanks,

-cb

0 Kudos
Message 1 of 5
(3,284 Views)
Solution
Accepted by 10Degree

I'm quite certain you can't get that information.

 

Instead, you can limit the creation and release of the queue to a manager VI, which will also keep track of the refs, but there is nothing preventing anyone else from messing this up, unless you wrap all interaction with the queue in a class.


___________________
Try to take over the world!
Message 2 of 5
(3,250 Views)

The "Get Queue Status" VI can tell you how many times you are trying to enqueue or dequeue elements from your named queue.  This isn't quite the same as the question you raised, but may provide the info you need.  I haven't tried this myself (I mistakenly wired this thinking it told me the number of elements in the queue, found out it was "something else") -- write a simple test routine and see if this does the trick.

 

Bob Schor

0 Kudos
Message 3 of 5
(3,224 Views)

Bob Schor wrote:

I mistakenly wired this thinking it told me the number of elements in the queue


The primitive itself does this. There's an output on the bottom which does exactly that, and if you wire T into the boolean input, will even return a copy of all the elements.


___________________
Try to take over the world!
0 Kudos
Message 4 of 5
(3,220 Views)

Gents,

 

Thanks for the input.  It seems like I will need to write a Q factory VI to provide the counting services I need.

 

-cb

0 Kudos
Message 5 of 5
(3,195 Views)