Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017 
<== Date ==> <== Thread ==>

Subject: Re: Exiting IOC
From: Andrew Johnson <anj@aps.anl.gov>
To: kimkh@nfrc.re.kr
Cc: tech-talk@aps.anl.gov
Date: Mon, 03 Apr 2006 13:02:11 -0500
kimkh@nfrc.re.kr wrote:

When I type "exit" on IOC shell, I would like to call a particular function
to return system resource and then want to terminate the IOC. Is there any
mechanism to register the particular function?

If you are using Base R3.14.7 or later, there is a facility in libCom that you can use:


void epicsAtExit((*epicsExitFunc)(void *arg), void *arg);

You use it like this:


#include "epicsExit.h"


void myExit(void *myptr) {
    /* my cleanup code */
}

...
    epicsAtExit(myExit, (void *)myptr);
...


When the IOC exits, the myExit routine will be called with myptr as its argument, which allows you to register the same routine several times with different pointers if you wish (you can always pass in NULL if you don't need a context pointer at all).


If your code has to work on an earlier version of Base though, Mark Rivers' solution is your best bet.

- Andrew
--
There is no S in exprexxo.

References:
Exiting IOC kimkh

Navigate by Date:
Prev: RE: LabVIEW and ChannelAccess? Bill St.Arnaud
Next: IOC shutdown signal(s) Rod Nussbaumer
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017 
Navigate by Thread:
Prev: Exiting IOC kimkh
Next: RE: Exiting IOC Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017 
ANJ, 02 Sep 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·