11-07-2008 03:07 PM
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
Solved! Go to Solution.
11-08-2008 02:33 PM
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.
11-09-2008 11:33 AM
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
11-09-2008 11:49 AM
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.
11-10-2008 07:45 AM
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