pvalink: defer opening links until IOC running
This commit is contained in:
@ -115,6 +115,18 @@ void initPVALink(initHookState state)
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,6 +101,8 @@ struct pvaGlobal_t {
|
||||
|
||||
pvd::Mutex lock;
|
||||
|
||||
bool running; // set after dbEvent is initialized and safe to use
|
||||
|
||||
// a tuple of channel name and printed pvRequest (or Monitor)
|
||||
typedef std::pair<std::string, std::string> channels_key_t;
|
||||
// pvaLinkChannel dtor prunes dead entires
|
||||
|
@ -20,6 +20,7 @@ pvaGlobal_t::pvaGlobal_t()
|
||||
,provider_remote("pva")
|
||||
,create(pvd::getPVDataCreate())
|
||||
,queue("PVAL")
|
||||
,running(false)
|
||||
{
|
||||
// worker should be above PVA worker priority?
|
||||
queue.start(std::max(1, pvaLinkNWorkers), epicsThreadPriorityMedium);
|
||||
|
@ -76,6 +76,8 @@ void pvaOpenLink(DBLINK *plink)
|
||||
pvaGlobal->channels.insert(std::make_pair(key, chan));
|
||||
doOpen = true;
|
||||
}
|
||||
|
||||
doOpen &= pvaGlobal->running; // if not running, then open from initHook
|
||||
}
|
||||
|
||||
if(doOpen) {
|
||||
|
Reference in New Issue
Block a user