To download NI software, including the products shown below, visit ni.com/downloads.
1. Overview:
This VI implements producer/consumer design patter. Instead of destroying the queue as soon as the VI is stopped, this VI retrieves all the data in the queue before exiting.
2. Description:
The design template Producer/Consumer (Events) is a great parallel loop architecture for situations where the processing of data can take longer than the time it takes to acquire thedata, and it is necessary to process all data that is acquired by the producer loop. However, with the default design template the queue is destroyed as soon as the user clicks on the stop button, erasing any elements that remained in the queue to be processed by the consumer loop.
The attached VI eliminates this behavior, by utilizing the Get Queue Status.vi function to see if any elements remain in the queue, and does not stop until all elements in the queue have been processed by the consumer loop.
3. Requirements
4. Steps to Implement or Execute Code
5. Additional Information or References
VI Block Diagram
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.