LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically distinguish between running and reserved vi's

I want to programatically check whether a VI is running. I tried to use the "ExecutionState" property, but this did not work for me. My problem is that my definition of running does not match the execution state property’s definition of running:

 

My Definitions

·         Running = Some element of this VI is currently executing (run arrow looks like this: run arrow.png)

·         Reserved = This VI is a sub VI of a running VI, but this VI is not actually running (run arrow looks like this: reserved arrow.png)

·         Idle = This VI is in memory but is not running or reserved (run arrow looks like this: idle arrow.png)

 

 

Execution State property definitions

·         Running = Some element of this VI is currently executing   OR   this VI is a sub VI of a running VI (run arrow looks like this run arrow.png or like this reserved arrow.png)

·         Idle = This VI is in memory but is not running (run arrow looks like this: idle arrow.png)

 

 

Since each VI's front panel displays a running arrow when that VI is running and a reserved arrow when that VI is reserved, there must be some way to programatically distinguish between these two states.  I hope that this distinction is exposed to programmers.

0 Kudos
Message 1 of 7
(3,018 Views)

If you could give us a description of why you want to do this, someone may have an alternative way of doing it.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 2 of 7
(2,998 Views)

I am trying to debug a large application.  This application dynamically launches many VI's that run in their own threads.  When the application shuts down it is supposed to close all of these dynamic VI's, but sometimes it does not.  I want to know which VI's are still running. My problem is made more difficult by the fact that most of the VI's are reentrant.

 

 

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

Got it. Did you check whether you get Running on Top level or Running?.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 7
(2,977 Views)

Thank you for your suggestion.  I have tried to use the execution state property, but I have found that it doesn't give me all the information that I am looking for: it doesn't differentiate between running and reserved VI's (see my original post).

0 Kudos
Message 5 of 7
(2,972 Views)

Have you tried running the Desktop Execution Trace? It is really good at identifying resources that aren't getting closed.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 6 of 7
(2,957 Views)

You should also go vote for this idea - http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Need-a-way-to-visualize-VI-call-chain-hierarchy/idi-p/...

 

 

Just to expand on P@Anand's suggestion, because it is a good one - you can obtain references to all the VIs and check their state, and then open the BDs of those which are Run Top Level and manuallly inspect where the code is actually stuck.

 

Note that if your top level VIs are the ones which are reentrant, you will need to open a reference to the clone, and that's not listed in the All VIs In Memory property, although there are some ways around that. You can try to open N references in a loop using MyVI.vi:# as the VI name and ignore those which return an error, but you should note that the numbers don't necessarily start from 1 and that NI might close up the option to get the clone references like that.

 

You could also try closing the main VI to unload it and then opening a new one and looking at the Unopened SubVIs hierarchy, which should list all of the clones. I'm assuming that if the main VI is unloaded, only the clones which are still running will still be in memory, but that might change if you have classes (which don't unload) and I haven't actually tried this myself.


___________________
Try to take over the world!
0 Kudos
Message 7 of 7
(2,935 Views)