LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Queue name in reentrant vi

Solved!
Go to solution

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

0 Kudos
Message 1 of 6
(3,598 Views)

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).


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 6
(3,595 Views)
Solution
Accepted by pawhan11

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.

0 Kudos
Message 3 of 6
(3,586 Views)

Thanks, Thats all I wanted to know 🙂

0 Kudos
Message 4 of 6
(3,573 Views)
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).
Message 5 of 6
(3,549 Views)

@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. 

0 Kudos
Message 6 of 6
(3,532 Views)