caProvider: speed up monitor list handling

Not a major speed-up since the list of monitors is per-channel,
but using wptr::expired() is more efficient than wptr::lock().
This commit is contained in:
Andrew Johnson
2021-10-01 09:54:14 -05:00
parent 671f5a406c
commit 161eac3a38

View File

@ -300,10 +300,10 @@ void CAChannel::addMonitor(CAChannelMonitorPtr const & monitor)
{
std::vector<CAChannelMonitorWPtr>::iterator it;
for (it = monitorlist.begin(); it!=monitorlist.end(); ++it) {
CAChannelMonitorWPtr mon = *it;
if (mon.lock()) continue;
mon = monitor;
return;
if (it->expired()) {
*it = monitor;
return;
}
}
monitorlist.push_back(monitor);
}