alecjcook Posted October 13, 2015 Report Share Posted October 13, 2015 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 Quote Link to comment
drjdpowell Posted October 13, 2015 Report Share Posted October 13, 2015 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. Quote Link to comment
alecjcook Posted October 13, 2015 Author Report Share Posted October 13, 2015 Ey, you clever bugger. I'd spent days on that. Thanks for the tip! I now create the queue in the called vi, instead of the calling vi, and the architecture works spot on like expected!Many thanks, Alec Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.