diff --git a/src/pvxs/sharedpv.h b/src/pvxs/sharedpv.h index d1d24f1..95e69a7 100644 --- a/src/pvxs/sharedpv.h +++ b/src/pvxs/sharedpv.h @@ -99,6 +99,9 @@ struct PVXS_API StaticSource //! Fetch the Source interface, which may be used with Server::addSource() std::shared_ptr source() const; + //! call SharedPV::close() on all PVs + void close(); + //! Add a new name through which a SharedPV may be addressed. StaticSource& add(const std::string& name, const SharedPV& pv); //! Remove a single name diff --git a/src/sharedpv.cpp b/src/sharedpv.cpp index 8ee79aa..52fbd76 100644 --- a/src/sharedpv.cpp +++ b/src/sharedpv.cpp @@ -506,6 +506,20 @@ std::shared_ptr StaticSource::source() const return impl; } +void StaticSource::close() +{ + if(!impl) + throw std::logic_error("Empty StaticSource"); + + { + auto G(impl->lock.lockReader()); + + for(auto& pair : impl->pvs) { + pair.second.close(); + } + } +} + StaticSource& StaticSource::add(const std::string& name, const SharedPV &pv) { if(!impl)