Experimental Physics and
| |||||||||||||||
|
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
| ||||||||||||||
ANJ, 22 Feb 2023 |
·
Home
·
News
·
About
·
Base
·
Modules
·
Extensions
·
Distributions
·
Download
·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing · |