diff --git a/src/factory/ChannelAccessFactory.cpp b/src/factory/ChannelAccessFactory.cpp index 0842c3f..856cc5b 100644 --- a/src/factory/ChannelAccessFactory.cpp +++ b/src/factory/ChannelAccessFactory.cpp @@ -9,6 +9,7 @@ #include #include +#include #include #include @@ -18,6 +19,7 @@ #define epicsExportSharedSymbols #include +#include #include #include "pv/codec.h" #include @@ -161,7 +163,12 @@ epicsThreadOnceId providerRegOnce = EPICS_THREAD_ONCE_INIT; void providerRegInit(void*) { + epicsSignalInstallSigAlarmIgnore(); + epicsSignalInstallSigPipeIgnore(); + providerRegGbl = new providerRegGbl_t; + providerRegGbl->clients->add("pva", createClientProvider); + registerRefCounter("ServerContextImpl", &ServerContextImpl::num_instances); registerRefCounter("ServerChannel", &ServerChannel::num_instances); registerRefCounter("BlockingTCPTransportCodec", &detail::BlockingTCPTransportCodec::num_instances); diff --git a/src/pva/clientFactory.cpp b/src/pva/clientFactory.cpp index 6cd6714..d00aab2 100644 --- a/src/pva/clientFactory.cpp +++ b/src/pva/clientFactory.cpp @@ -6,60 +6,17 @@ #include -#include -#include #include #define epicsExportSharedSymbols -#include #include -#include using namespace epics::pvData; using namespace epics::pvAccess; -static -void pva_factory_cleanup(void*) -{ - try { - ChannelProviderRegistry::clients()->remove("pva"); - } catch(std::exception& e) { - LOG(logLevelWarn, "Error when unregister \"pva\" factory"); - } -} - void ClientFactory::start() { - epicsSignalInstallSigAlarmIgnore(); - epicsSignalInstallSigPipeIgnore(); - - if(ChannelProviderRegistry::clients()->add("pva", createClientProvider, false)) - epicsAtExit(&pva_factory_cleanup, NULL); + // 'pva' registration in ChannelAccessFactory.cpp } -void ClientFactory::stop() -{ - // unregister now done with exit hook -} - -// automatically register on load -namespace { -struct pvaloader -{ - pvaloader() { - ClientFactory::start(); - } -} pvaloaderinstance; -} // namespace - -// perhaps useful during dynamic loading? -extern "C" { -void registerClientProvider_pva() -{ - try { - ClientFactory::start(); - } catch(std::exception& e){ - std::cerr<<"Error loading pva: "<