01-07-2015 04:38 AM
Hello.
I have reentrant vi that spawns handles some communication. At start this reentrant vi creates its own queue. Should I give name to that queue?? What will happen if this vi spawns many times? They will share the same queue (by name) or they will create new ones?
Thanks
Solved! Go to Solution.
01-07-2015 04:40 AM
If you leave the queue name unwired it will create an unnamed queue with its own queue reference. Each time you do this the queue reference will be unique so no, they won't share the queue name (in fact, you can't get the queue name from an unnamed queue).
01-07-2015 04:51 AM
It's still better to handle the names of the queues in case you have to obtain the queue reference somewhere else in your code. For a reentrant VI spawning the queues, the usual way to do it is by the property node "VI Name". If the VI is reentrant, the VI Name string contains the clone number and this one is unique 🙂
Regards,
Eric M. - Senior Software Engineer
Certified LabVIEW Architect - Certified LabVIEW Embedded Systems Developer - Certified LabWindows™/CVI Developer
Neosoft Technologies inc.
01-07-2015 05:30 AM
Thanks, Thats all I wanted to know 🙂
01-07-2015 08:45 AM
01-07-2015 10:32 AM
@nathand wrote:
Disagree on "better to handle queue names..." Unless you know that you WILL need to access the queue by name, it is best to use unnamed queues. That way you can't accidentally write to the queue from somewhere else, and it avoids the common memory leak that occurs when someone doesn't realize that each new reference to a named queue needs to be released (releasing just one doesn't destroy the queue).
Yup I couldn't agree more. When dealing with Queues do it by reference, not by name. If you want access to a Queue somewhere in your application, provide the reference to the Queue. Doing it by name can be more difficult to debug, and understand as a new developer.
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord