LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waiting to run state and asynchronous control...

Solved!
Go to solution

I have a VI that I call asynchronously.

 

When I run it, I record the refnum for it and look at its execution state to see if it stops running. At some point, the asynchrounous VI goes from running to waiting to run. How can I see using the property node the state of the VI. I assumed, apparently incorrectly, that when a subvi is "waiting to run" that it would be in a execution state other than "Running". Is there something else I should be looking for? What isn't working here?

 

I'd certainly prefer this solution over some other solution like sending a user event or notification since it doesn't place any restrictions on the subvi (i.e. the subvis connector plane).

 

Thanks!

0 Kudos
Message 1 of 3
(3,505 Views)
Solution
Accepted by topic author majoris

The way I do this is to use Start Asynchronous Call using the Call and Collect option.  To tell if the VI has finished, I use a Wait on Asynchronous Call Node with a short Timeout -- if it has exited (returned), then the Wait will succeed without error, while if it is still running, the Wait will timeout, throwing an Error I can trap and clear.  My Wait routine then returns a boolean to signal if the Asynchronous routine has returned.  If it has, I can stop the Asynchronous routine using a targetted Abort VI. 

 

In one pretty big real-time project, I had about 5-6 Asynchronous "loops" running in parallel, completely detached.  When I was ready to shut them down, I used a VIG that was wired to their Stop indicator.  In my Main, I then called the Wait routine on all of my routines, looping until they call came back as "stopped", then I really "stopped" them by calling the "Stop" (Abort VI) option on each of them.

 

Bob Schor

Message 2 of 3
(3,488 Views)

Ah, this makes sense. I'll try it tomorrow. I did set it to call and forget so I guess it's always running then? It's weird that I can't see the state of the VI the same way Labview can...

0 Kudos
Message 3 of 3
(3,478 Views)