Jump to content

Recommended Posts

Hi,

does anyone know how to detect if a VI is stopped througth "abort"?

cosmin

Ummm. You can program the VI to change the value of some boolean indicator when it finishes normally (well, just the last thing it does before the end). So, if it's aborted, that value would be different.

Is that what you were asking?

Saludos,

Aitor

Link to post
Share on other sites
You can monitor the execution state of the vi and react if the vi goes to idle

I just asked if exist a simple method of detecting abort, if you got a VI that works as process in windows, when you stop the process or windows shutdown, the vi is aborted and any cleanup does not occur. so I had to do cleanup somewhere else and monitoring the state of VI at rapidly to do the cleanup before complete shutdown.

cosmin

Link to post
Share on other sites
I just asked if exist a simple method of detecting abort, if you got a VI that works as process in windows, when you stop the process or windows shutdown, the vi is aborted and any cleanup does not occur. so I had to do cleanup somewhere else and monitoring the state of VI at rapidly to do the cleanup before complete shutdown.

cosmin

You can use an event structure and catch the Application Exit event.

If you use the filter event you can even prevent your app from exiting this way.

Link to post
Share on other sites
You can use an event structure and catch the Application Exit event.

If you use the filter event you can even prevent your app from exiting this way.

Actually I believe he was talking about when someone presses the VI's "Abort Execution" button (the stop sign on the toolbar) and there is no event to capture that.

The VI just stops dead in its tracks.

It has to work this way to allow people to stop VI's that have infinite loops built into their exit cleanup routines. :D

You can always prevent the user from accessing the abort button however.

See here and here for more discussion.

The attached VI (LV v7.1.1) is a simple way of trying some of this out.

Download File:post-2800-1141994145.zip

Link to post
Share on other sites

One possibility is to create a CIN and use its CINAbort functionality. From the PDF "Using External Code in LabVIEW":

When you abort a VI, LabVIEW calls the CINAbort routine for every reference to a code resource contained in the VI being aborted.

Link to post
Share on other sites
One possibility is to create a CIN and use its CINAbort functionality. From the PDF "Using External Code in LabVIEW":

When you abort a VI, LabVIEW calls the CINAbort routine for every reference to a code resource contained in the VI being aborted.

Hi,

actually I was talking about the abort that takes place when a user stop a process from services, none of the events works for me (exit, exit?) not even CINAbort .

cosmin

Link to post
Share on other sites
Hi,

actually I was talking about the abort that takes place when a user stop a process from services, none of the events works for me (exit, exit?) not even CINAbort .

cosmin

Hmmm, you're right.. The Exit event only works from the taskmanager's applications tab, not if you kill a process from the processes tab. I guess that's equivalent to unix's kill -9 to unconditionally kill a process.

I think that's a good thing btw. There always should be a possibility to unconditionally kill runaway or zombie processes.

If you really don't want the user to shutdown your app that way, make sure he doesn't have rights to do that. Don't know much about Windows' user management, but I'm pretty sure a 'normal' user won't be allowed to kill a process that isn't started in the same user's context.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.