diff --git a/src/clientmon.cpp b/src/clientmon.cpp index 895eadb..1cd7075 100644 --- a/src/clientmon.cpp +++ b/src/clientmon.cpp @@ -468,6 +468,8 @@ void Connection::handle_MONITOR() peerName.c_str(), mon->chan->name.c_str()); + Guard G(mon->lock); + mon->queue.emplace_back(std::move(update)); notify = true; diff --git a/src/servermon.cpp b/src/servermon.cpp index d9fc364..51046b5 100644 --- a/src/servermon.cpp +++ b/src/servermon.cpp @@ -223,8 +223,11 @@ struct ServerMonitorControl : public server::MonitorControlOp if(val && mon->type && mon->type.get()!=Value::Helper::desc(val)) throw std::logic_error("Type change not allowed in post(). Recommend pvxs::Value::cloneEmpty()"); - if(testmask(val, mon->pvMask)) { - Guard G(mon->lock); + // pvMask is const at this point, so no need to lock + bool real = testmask(val, mon->pvMask); + + Guard G(mon->lock); + if(real) { if((mon->queue.size() < mon->limit) || force || !val) { mon->queue.push_back(val);