06-12-2012 10:41 PM
Queues we generally use when we are running parallel loops and had to transfer data from one loop to the other. For using the queue in different vi's we use LV2G (Functional Global) to take its reference so wherever the queue is need we can use the LV2G and use it.
06-13-2012 12:10 AM - edited 06-13-2012 12:11 AM
@P Anand wrote:
Queues we generally use when we are running parallel loops and had to transfer data from one loop to the other. For using the queue in different vi's we use LV2G (Functional Global) to take its reference so wherever the queue is need we can use the LV2G and use it.
My prefered solution also.
06-13-2012 01:54 AM
@diarmaede wrote:
All these answers make sense. Thanks. I've been creating local variables of the output of the "Obtain Queue" function and using them, instead of wiring the queue directly. Is there anything inherently wrong with this approach? I suppose it could cause some timing conflicts.
Exactly, Locals has a big chance of creating race conditions. /Y
06-13-2012 06:21 AM
I always name my queues but never obtain the queue in another location by name (use the wire when possible since this is common practice in LV development). The reason I name my queues is for better readability code documentation and most importantly error handling. If your queue throws an error the name of the queue is passed to the error handler and makes debugging easier.
06-13-2012 06:30 AM
@falkpl wrote:
...If your queue throws an error the name of the queue is passed to the error handler and makes debugging easier.
Never knew that. Maybe I will start naming my queues now...
06-13-2012 06:43 AM
I thought this worked as it does in daq, but it might not.
I still like naming my queues and tasks for documentation eighte way
06-13-2012 06:53 AM
I just looked at some code and found why my errors show the queue name, I wrote a FG that uses the queue name and makes its own error messages, the queue name is accessable from the queue status, but using the queue name in error messages would be a good idea. DAQ does this for channels and tasks and it is a lifesaver when you have hundreds of channels.
06-13-2012 06:58 AM
A lot of good reasons given here for naming queues. I recently just started always naming my queues simply because I wish I had on previous occasions. It's always better to have too much information than not enough.
06-13-2012 08:38 AM
I seldom name my queues and various methods to pass the queue ref wire to whoever needs it.
The reason I avoid the name and use the wire is it allows me to quickly clone parts of application without concerns of the cloned code using the queue of the original code. To use named queus and avoid the cross-talk I would have to use some method to ensure the queue name for both instances was unique ... and I may as well pass the queue ref if I am passing a name prefix or what-not.
Ben
06-13-2012 10:55 AM
Instead of using the queue name, I rewrote my code to use a Sequence Local to pass the queue wire from one frame of my stacked sequence to the next. Is there anything wrong with this approach?