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  <20232024  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  <20232024 
<== Date ==> <== Thread ==>

Subject: Re: Re: Questions related to mcoreutil
From: Ralph Lange via Tech-talk <tech-talk at aps.anl.gov>
To: EPICS Tech Talk <tech-talk at aps.anl.gov>
Date: Wed, 22 Feb 2023 10:57:54 +0100
Hi Daeyoung,

So the reason is clear. Good!

MCoreUtils uses the EPICS registrar functionality for its initialization. That mechanism runs the MCoreUtils initializer as part of the "<appname>_registerRecordDeviceDriver pdbbase" call in the st.cmd startup script.
That's why moving around things in the Makefile won't help. Nothing from EPICS Base will be run as early as the beginning of the main() routine, where you are starting your threads.

Maybe you can start your threads later, using an EPICS mechanism?!
You could use a registrar function (like MCoreUtils) to have it executed during the "<appname>_registerRecordDeviceDriver pdbbase" call and start your threads there. The disadvantage is that EPICS Base doesn't really guarantee the order of registrar functions being called. You can change the order of the definitions in the DBD file until you see that MCoreUtils is initialized before your registrar function is called, but that would still not be robust.
Or (preferred) you can start your threads in a function that can be called from the startup script. That will require a wrapper/structure boilerplate that is used to register the command with the IOC shell from a registrar function. Once that is done, you can call "your" command from the IOC shell st.cmd script (it will be available after/below the "<appname>_registerRecordDeviceDriver pdbbase" call) whenever you want to start your threads. That solution is robust and gives you much better control when things are happening. (Once you have that mechanism in place, you may even find it convenient to add more IOC shell commands for monitoring and debugging, like showing the status of your threads or some statistics.)

The Application Developers Guide (version 3.16.2 is the latest) has the necessary documentation. You can also look at some other EPICS module that registers commands for the IOC shell. MCoreUtils does it, as explained.

Good luck!
~Ralph


References:
Re: Questions related to mcoreutil Ralph Lange via Tech-talk
Re: Re: Questions related to mcoreutil 김대영 via Tech-talk

Navigate by Date:
Prev: S7nodave for EPICS Manual White via Tech-talk
Next: RE: EPICS deb/rpm packaging Abdalla Ahmad 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  <20232024 
Navigate by Thread:
Prev: Re: Re: Questions related to mcoreutil 김대영 via Tech-talk
Next: measComp R4-1 available Mark Rivers 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  <20232024 
ANJ, 22 Feb 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·