diff options
author | Anna Henningsen <anna@addaleax.net> | 2021-05-23 17:17:06 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2021-05-25 17:19:04 +0300 |
commit | 46eb417b6f304ed6e22f3366fda228116b020261 (patch) | |
tree | a49e3e64dcaa67e43f52d4ba560ade792baba724 /src/node_messaging.h | |
parent | f9447b71a6b458adbb265f8a5fd38ebf41bc97a4 (diff) |
worker: use rwlock for sibling group
Since it is much more common to send messages than to add or
remove ports from a sibling group, using a rwlock is appropriate here.
Refs: https://github.com/nodejs/node/issues/38780#issuecomment-846548949
PR-URL: https://github.com/nodejs/node/pull/38783
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/node_messaging.h')
-rw-r--r-- | src/node_messaging.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/node_messaging.h b/src/node_messaging.h index 799bece3cbd..eeef974ff35 100644 --- a/src/node_messaging.h +++ b/src/node_messaging.h @@ -150,9 +150,9 @@ class SiblingGroup final : public std::enable_shared_from_this<SiblingGroup> { size_t size() const { return ports_.size(); } private: - std::string name_; + const std::string name_; + RwLock group_mutex_; // Protects ports_. std::set<MessagePortData*> ports_; - Mutex group_mutex_; static void CheckSiblingGroup(const std::string& name); |