04-21-2011 08:04 AM
Hi all,
I've been searching on forums the answer to the problem of stoping a while loop inside a subVI, which in turn inside a main program's while loop. I know some of you might say, but why would you want that, why don't you have either a parallel loop or make the use of the main while loop instead of the while loop in subVI. I agree with this reasoning, however, I still want to know if such thing possible.
Thanks in advance.
Viktar
04-21-2011 08:10 AM
You have a lot of options. You could use a functional global stop, a shared variable (if you have them) "all stop", or a stop using a notifier.
04-21-2011 09:16 AM
Are shared variables commonly used to stop a program across all VIs? With most of our LabVIEW programs at my work, if you click the exit button it will sometimes take a minute or two to get the program to stop while the current SubVI(s) finish up their work. That's not always desirable behavior... Would stopping the loops in these SubVIs with a "All Stop" shared variable be the way to do that? It seems like it is suggested that they are in the last post, but I just had to ask the specific question!
04-22-2011 05:39 PM
Hey zenthoef,
Like PaulG said, there are a few ways to accomplish this goal. Shared variables are a good option, and should complete the task at hand. Each subvi can read from from that shared variable and will know to stop as soon as it is changed. All you have to do is switch the variable on the main vi, and the subvi's will stop, assuming they are finishing their loops.
Regards,
Jake