yiguolei commented on a change in pull request #8759:
URL: https://github.com/apache/incubator-doris/pull/8759#discussion_r841026113
##########
File path: be/src/agent/topic_subscriber.cpp
##########
@@ -38,13 +38,13 @@ TopicSubscriber::~TopicSubscriber() {
void TopicSubscriber::register_listener(TTopicType::type topic_type,
TopicListener* listener) {
// Unique lock here to prevent access to listeners
- WriteLock lock(_listener_mtx);
+ std::lock_guard<std::shared_mutex> lock(_listener_mtx);
this->_registered_listeners[topic_type].push_back(listener);
}
void TopicSubscriber::handle_updates(const TAgentPublishRequest&
agent_publish_request) {
// Shared lock here in order to avoid updates in listeners' map
- ReadLock lock(_listener_mtx);
+ std::shared_lock<std::shared_mutex> lock(_listener_mtx);
Review comment:
Using std::shared_lock lock(_listener_mtx); instead of
std::shared_lock<std::shared_mutex> lock(_listener_mtx);
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]