Jump to content

Multi Thread Processors - Queue Based (CAL Prep)


Recommended Posts

Hi,

   I have been doing some prep for my CLA exam. I have created a piece of software that consists of 1 main control thread and 3 sub threads ("Aquire", "Analyse", "Log"). The main control thread is run, and the "Start" button kicks of the movement of data around the system. Everything appears to work as expected, but when the "Stop" button is pressed, sometimes all the threads finish normally, but sometimes they do not. I have no idea why not, LabVIEW Queue's are supposed to be lossless. Each sub-process has a catch in that if the command 'Stop' is sent the VI will stop.

   When the stop button is pressed, the command thread sends the 'Stop' command down to all of the sub processes. Can anyone tell me why sometimes they stop and sometimes they do not? 

Code Attached

IPC Test Project.zip

Link to comment

The lifetime of references like Queues are tied to their calling “hierarchy†(basically the top level VI).   Your main thread creates the Queues, so they die with it.   Your other ‘threads’, started by ACBR, are actually independent hierarchies.   If your main thread finishes before they have a chance to read the final message, then that message is lost.

 

Normally, I have the receiver of a Queue be the one to create it (and thus own it).  Use a temporary Queue to pass the created Queue back to the caller.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.