Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Why Can I Not Reference a Queue Created in a LabVIEW Executable from a LabVIEW VI?

Primary Software: LabVIEW Development Systems>>Full Development System
Primary Software Version: 7.1
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Run-Time Engine

Problem:
I have a LabVIEW Executable that creates a queue data structure and populates it with data. When I try to reference that queue from another VI, why does Dequeue.vi not see the queue?

Solution:
LabVIEW executables run in a different memory thread within Windows than VIs that are run in the LabVIEW Development Environment.  Any VIs called from a LabVIEW executable run in that executable’s memory thread.  No VIs or Executables from one memory thread can access queues that were created in another memory thread.

To demonstrate this behavior, unzip the "Memory Threads.zip" attached below, complete the following steps:

  1. Ensure that “Enqueue Basics.vi”, “Dequeue Basics.vi”, and “Remote Call.exe” are in the same folder.


  2. Run “Enqueue Basics.vi” and “Dequeue Basics.vi”.  The VIs operate as expected, one VI enqueuing data while the other VI dequeues the data.


  3. Stop and exit all VIs.


  4. Run “Remote Calls.exe”. Press the “Call “Enqueue Basics.vi”” button.  The “Enqueue Basics.vi” will execute within the “Remote Calls.exe” memory thread.  If you are using Windows XP, this can be seen in the Task Bar grouping.  Anything running in the “Remote Calls.exe” memory thread will appear in the same group on the Task Bar.


  5. Run “Dequeue Basics.vi” by double clicking on the icon.  The “Dequeue Basics.vi” is not receiving any data, because it does not have access to the queue created in the “Remote Calls.exe” memory thread.


  6. Press the “Call Dequeue Basics.vi” button in the “exeWithRemoteCallVI.exe” executable. The “Dequeue Basics.vi” will be called from the “Remote Calls.exe” memory thread.  It dequeues elements as expected.


Related Links:
KnowledgeBase 3S8RDE: What Is a Queue?
Developer Zone Tutorial: Using LabVIEW to Create Multithreaded Applications for Maximum Performance and Reliability

Attachments:


Memory Threads.zip - Memory Threads.zip



Report Date: 07/22/2005
Last Updated: 07/26/2007
Document ID: 3NL78PYV

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit