add StaticSource::close()
This commit is contained in:
@@ -99,6 +99,9 @@ struct PVXS_API StaticSource
|
||||
//! Fetch the Source interface, which may be used with Server::addSource()
|
||||
std::shared_ptr<Source> 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
|
||||
|
||||
@@ -506,6 +506,20 @@ std::shared_ptr<Source> 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)
|
||||
|
||||
Reference in New Issue
Block a user