Overview
This example demonstrates how a queue can be shared by multiple VIs in the same LabVIEW Project.
Description
The first VI, Enqueue.vi, obtains a queue called myQueue and enqueues integers 0 to 1 in a for loop. The second VI, Dequeue.vi, dequeues each element from myQueue and displays the result in an Array. The purpose of this is to demonstrate how, in a LabVIEW project, you can share a queue across VIs by writing the same queue name in the Obtain Queue function.
Steps to Implement or Execute Code
Requirements
Software
LabVIEW 2011 or later
Block Diagram
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Hi,
It is generally good practise to release the queue reference in both VIs. The reason you have a "force destroy" terminal is that releasing the queue does not destroy it if another queue reference is still live.
By doing this you avoid memory leaks if this method is used in your application in various places being ran sporadically.
Another nice way of doing this is sharing a queue reference wire using an FGV. This allows you to make descrete wrappers for your messagin system (much less spaghetti).
Here's a link to an example of using the Action Engine to hold the queue reference and then you just have to call the Action Engine to send your information. I do this for almost every system I make.
https://decibel.ni.com/content/docs/DOC-37042