From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stop a subVI

Solved!
Go to solution

The test program runs a subVI (switch_controller.vi)  with the Run VI Invoke Node.

The programmer has set the Auto Dispose Ref to True

and the Wait Until Done to False.

 

This subVI also is inserted into a subpanel on the main VI.

 

When the program is shutting down, he does a Remove VI to unload the VI in the subpanel,

however the subVI is still running in the background.

 

How do I stop it?

 

0 Kudos
Message 1 of 7
(3,536 Views)
Solution
Accepted by njacacia

The problem is that, only removing the subVI from the SubPanel does NOT stop it running!

Use the Abort VI Invoke Node with the subVI reference from the Main VI, then use the "Remove VI" from the subPanel...

 

But a proper stopping msg would be more appropriate. Use a UserEvent, Channel, FGV, or a Queue to notify the subVI it should stop running, since the main VI wants to shut down...

 

 

 

0 Kudos
Message 2 of 7
(3,522 Views)

Yes, you should use messaging of some sort.  I also tend to use a keep-alive timer in the main and pass a reference to the subvi.  The subvi periodically compares the keep-alive to its own time, and if it is off by a few seconds, shuts itself down.  This is useful in case of an aborted main vi.

0 Kudos
Message 3 of 7
(3,512 Views)

With this subVI it looks like it does check a Functional Global Variable.

Now I am perplexed as to why that check of the FGV does not stop this subVI which is continuously running in the background.

 

0 Kudos
Message 4 of 7
(3,510 Views)

DUH!

 

He is running the FGV within the subVI and the FGV is being set to its Init state.

 

Thanks.

 

Now I know what to do. 

0 Kudos
Message 5 of 7
(3,499 Views)

@njacacia wrote:

With this subVI it looks like it does check a Functional Global Variable.

Now I am perplexed as to why that check of the FGV does not stop this subVI which is continuously running in the background.

 


Well, we are even more blind than you, since we did not see a single VI so far 😄

 

edit: ok, good, you figured it out 🙂

0 Kudos
Message 6 of 7
(3,497 Views)

@Blokk wrote:

@njacacia wrote:

With this subVI it looks like it does check a Functional Global Variable.

Now I am perplexed as to why that check of the FGV does not stop this subVI which is continuously running in the background.

 


Well, we are even more blind than you, since we did not see a single VI so far 😄

 

edit: ok, good, you figured it out 🙂


This was a case of a small little icon for the FGV with input parameter set to Init being "overwhelmed" by the rest of the code in the subVI.    🙂

0 Kudos
Message 7 of 7
(3,458 Views)