How can I stop a vi that is caught in an infinite loop from that vi's caller? 
Author Message
 How can I stop a vi that is caught in an infinite loop from that vi's caller?

Hello,

Is there a way to stop a subvi from a higher level vi?  I'd like to
stop a vi programmatically from within its caller, not within the vi
itself.

I'm using labview's Internet Toolkit for FTP-ing files to the web.
And the FTP "put multiple files" vi periodically hangs in an infinite
loop.  Labview Tech support knows about this issue, but has no
conclusive fix right now.

I already placed a timeout in one of the lower level vi's known to be
causing problems, but it still seems to hang sometimes, albeit less
often.

As an extra work around, I'd like to put a time-out in a high level vi
that calls the main FTP vi.  I need the timeout to stop this FTP vi
without stopping the vi that calls it or exiting Labview.

Thank you,

Tom



Sat, 25 Jun 2005 02:59:53 GMT  
 How can I stop a vi that is caught in an infinite loop from that vi's caller?
Hi Tom,

I believe if you stop a VI that is inculded in the diagram of a
caller, the calling VI should stop as well.

If you use an invoke node to launch the VI, you mat be able to use an
invoke node>>>Abort VI.

Not sure if this is the trick.

Please let me one way or the other.

Ben



Sat, 25 Jun 2005 21:42:58 GMT  
 How can I stop a vi that is caught in an infinite loop from that vi's caller?
Ben,

Thank you for your response.  I actually just implemented the invoke
node yesterday and thought I had the problem{*filter*}ed.  The "Abort VI"
setting does indeed close the subvi without stopping the caller, but
with a price.

Now, I can't find a way to determine when the subvi is finished.  I'm
considering having the subvi write a temporary file, registry key, or
something similar when it completes.  This file or key will be
continuously polled by the caller until it finds it or a timeout
expires.

If the timeout is reached, Abort VI will be sent; if the file or key
is found, the subvi has completed and abort vi is not necessary.

What do you think?  If you know of a better way to determine when the
subvi finishes, please let me know.

Thanks again,

Tom



Sat, 25 Jun 2005 22:03:36 GMT  
 How can I stop a vi that is caught in an infinite loop from that vi's caller?

Quote:
> What do you think?  If you know of a better way to determine when the
> subvi finishes, please let me know.

If you want something lighter weight, consider making a scoreboard
global VI.  Let's assume the subVI being called is A.  Build a smart or
LV2 style global that keeps an array of Booleans that indicate what is
currently being executed and what has completed.  Before making the
subVI call to A, call the scoreboard VI asking it to reserve a unique
spot in its array of execution states, setting the element to TRUE and
returning the index.  Then pass the index to the subVI.  As close to the
end of A's execution as possible, have A call the smart global passing
in the index to clear the Boolean.  When the caller's timeout timer goes
off, it can check the global using the index to see if it has finished
or is still executing.

All that being said, you should know that aborting a subVI is not the
same as killing a thread, and it requires that the subVI be in control
and able to respond.  If the subVI calls into a system call, a DLL, or a
driver then it will not abort until the call returns.  The same is true
for the execution of individual nodes that take a long time to execute.

Greg McKaskle



Sun, 26 Jun 2005 12:26:26 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Need to display sub-vi front panels without stopping WHILE loop containing those VI's

2. Stop running vi from another vi

3. I am looking for a VI that login and logout users to a main VI.

4. convert's labview 6.1 vi's to labview 5.1 vi's

5. How to identify VI's without callers?

6. VI's GUI events disturb another VI's work

7. Unlock VI, File>>VI Properties dosn't work

8. Incorporating three .vi's into a master .vi

9. Help with this vi and top level vi's

10. Remote VI won't load when called with VI Server

11. I would like to integrate many VI's into one VI.

12. Selecting diferent sub Vi's from main VI

 

 
Powered by phpBB® Forum Software