LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with queues in template VIs

Hi, I am having problems with the queue VIs in 6.0.2 I have a master VI which spawns multiple instances of a VI template. The master VI also creates a queue, which the spawned VIs gain access to though a 'create new queue'. The spawned VIs send data to the master VI though this queue. But all is not well, i seem to loose the queue elements from the spawned VIs, though out the run the queue will loose various elements and at some points i will not get any commands from one particular sub VI. I know its quite complex, but if any one has any ideas please help. Thanks, Tom WP
0 Kudos
Message 1 of 3
(2,646 Views)
Pay attention to when and which VI tree creates the queue first. It is because the queue is automatically destroyed when this VI tree stops.

For example, Instance1.vi starts and creates the queue. Instance2.vi starts and uses the queue for data exchange with Instance1.vi. Instance1.vi, the creator, quits then the queue is destroyed. The queue refnum copy hold in Instance2.vi is invalid. If you then start Instance3.vi, it recreates the queue with the same name, but with a different refnum. This is a new, different queue so that Instance2.vi and Instance3.vi can't communicate using it.

The solution is to create the queue in a VI that will run as long as the queue is required, such as in the main Top Level VI.


LabVIEW, C'est LabVIEW

0 Kudos
Message 2 of 3
(2,646 Views)
Thanks for the help, but i already create the queue in the top level VI which is open for the duration. The queue is valid all the way through the program, its just that the queue seems to lose elements at points in the program. It seems to me like the 'write to queue' function is not protected properly if run by copies of a template VI.

Cheers Tom.
0 Kudos
Message 3 of 3
(2,646 Views)