pvalink: delay QSRV instanciation
Must be delayed until after dbChannelInit(), but still want to allocate pvaGlobal prior to link init. Unfortunately, no initHook between these steps. So split initialization further.
This commit is contained in:
@ -90,13 +90,24 @@ static void finalizePVA(void*)
|
||||
|
||||
bool atexitInstalled;
|
||||
|
||||
/* The Initialization game...
|
||||
*
|
||||
* # Parse links during dbPutString() (calls our jlif*)
|
||||
* # announce initHookAfterCaLinkInit
|
||||
* # dbChannelInit() (needed for QSRV to work)
|
||||
* # Re-parse links (calls to our jlif*)
|
||||
* # Open links. Calls jlif::get_lset() and then lset::openLink()
|
||||
* # announce initHookAfterInitDatabase
|
||||
* # ... scan threads start ...
|
||||
* # announce initHookAfterIocBuilt
|
||||
*/
|
||||
void initPVALink(initHookState state)
|
||||
{
|
||||
if(state==initHookAfterCaLinkInit) {
|
||||
// before epicsExit(exitDatabase)
|
||||
// so hook registered here will be run after iocShutdown()
|
||||
// which closes links
|
||||
try {
|
||||
try {
|
||||
if(state==initHookAfterCaLinkInit) {
|
||||
// before epicsExit(exitDatabase),
|
||||
// so hook registered here will be run after iocShutdown()
|
||||
// which closes links
|
||||
if(pvaGlobal) {
|
||||
cantProceed("# Missing call to testqsrvShutdownOk() and/or testqsrvCleanup()");
|
||||
}
|
||||
@ -107,26 +118,31 @@ void initPVALink(initHookState state)
|
||||
atexitInstalled = true;
|
||||
}
|
||||
|
||||
}catch(std::exception& e){
|
||||
cantProceed("Error initializing pva link handling : %s\n", e.what());
|
||||
}
|
||||
|
||||
} else if(state==initHookAfterIocBuilt) {
|
||||
// after epicsExit(exitDatabase)
|
||||
// so hook registered here will be run before iocShutdown()
|
||||
epicsAtExit(stopPVAPool, NULL);
|
||||
|
||||
Guard G(pvaGlobal->lock);
|
||||
pvaGlobal->running = true;
|
||||
|
||||
for(pvaGlobal_t::channels_t::iterator it(pvaGlobal->channels.begin()), end(pvaGlobal->channels.end());
|
||||
it != end; ++it)
|
||||
{
|
||||
std::tr1::shared_ptr<pvaLinkChannel> chan(it->second.lock());
|
||||
if(!chan) continue;
|
||||
|
||||
chan->open();
|
||||
} else if(state==initHookAfterInitDatabase) {
|
||||
pvac::ClientProvider local("server:QSRV"),
|
||||
remote("pva");
|
||||
pvaGlobal->provider_local = local;
|
||||
pvaGlobal->provider_remote = remote;
|
||||
|
||||
} else if(state==initHookAfterIocBuilt) {
|
||||
// after epicsExit(exitDatabase)
|
||||
// so hook registered here will be run before iocShutdown()
|
||||
epicsAtExit(stopPVAPool, NULL);
|
||||
|
||||
Guard G(pvaGlobal->lock);
|
||||
pvaGlobal->running = true;
|
||||
|
||||
for(pvaGlobal_t::channels_t::iterator it(pvaGlobal->channels.begin()), end(pvaGlobal->channels.end());
|
||||
it != end; ++it)
|
||||
{
|
||||
std::tr1::shared_ptr<pvaLinkChannel> chan(it->second.lock());
|
||||
if(!chan) continue;
|
||||
|
||||
chan->open();
|
||||
}
|
||||
}
|
||||
}catch(std::exception& e){
|
||||
cantProceed("Error initializing pva link handling : %s\n", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,9 +16,7 @@ pvaGlobal_t *pvaGlobal;
|
||||
|
||||
|
||||
pvaGlobal_t::pvaGlobal_t()
|
||||
:provider_local("server:QSRV")
|
||||
,provider_remote("pva")
|
||||
,create(pvd::getPVDataCreate())
|
||||
:create(pvd::getPVDataCreate())
|
||||
,queue("PVAL")
|
||||
,running(false)
|
||||
{
|
||||
|
Reference in New Issue
Block a user