EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  <2025 Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  <2025
<== Date ==> <== Thread ==>

Subject: Re: RFC: add a mechanism to call epicsExit when signals are received
From: Jure Varlec via Tech-talk <tech-talk at aps.anl.gov>
To: tech-talk at aps.anl.gov
Date: Thu, 3 Apr 2025 15:17:49 +0200
On 4/3/25 11:34, Michael Davidsaver via Tech-talk wrote:
wrt. your attached epicsSignalExit.cpp, the method epicsSignalExit::getInstance()
is not async safe since (depending on c++ version) it will run the class
epicsSignalExit constructor.

I don't think that's the case. The signal handler is run only if it is first registered using epicsExitOnSignal(), presumably from iocsh. getInstance() is first used there, which constructs the static object. The next invocation of getInstance() (from the signal handler) will not run the contructor.

If this feels icky to you, there might be another approach. Have a global bool specifying whether this feature is enabled or not. The iocsh command then only sets this flag. Thread creation and handler registration is done at IOC init, if the flag is set.

Érico, I don't have the time right now to look deeper into this, but I would love to see something like this because it would make managing IOCs via Systemd more straightforward, not to mention making compulsive use of C-c to terminate IOCs nicer. Thanks for pushing this forward!

Best,
Jure


Replies:
Re: RFC: add a mechanism to call epicsExit when signals are received Michael Davidsaver via Tech-talk
References:
RFC: add a mechanism to call epicsExit when signals are received Érico Nogueira Rolim via Tech-talk
Re: RFC: add a mechanism to call epicsExit when signals are received Michael Davidsaver via Tech-talk

Navigate by Date:
Prev: Re: RFC: add a mechanism to call epicsExit when signals are received Ralph Lange via Tech-talk
Next: Re: Stream2 support in ADEiger Yendell, Gary (DLSLtd, RAL, LSCI) via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  <2025
Navigate by Thread:
Prev: Re: RFC: add a mechanism to call epicsExit when signals are received Michael Davidsaver via Tech-talk
Next: Re: RFC: add a mechanism to call epicsExit when signals are received Michael Davidsaver via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  <2025
ANJ, 03 Apr 2025 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions ·
· Download · Search · IRMIS · Talk · Documents · Links · Licensing ·