Skip to content

Commit

Permalink
caProvider: speed up monitor list handling
Browse files Browse the repository at this point in the history
Not a major speed-up since the list of monitors is per-channel,
but using wptr::expired() is more efficient than wptr::lock().
  • Loading branch information
anjohnson committed Oct 1, 2021
1 parent 671f5a4 commit 161eac3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ca/caChannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 161eac3

Please sign in to comment.