Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2020-02-13 18:31:05 +0300
committerAnna Henningsen <anna@addaleax.net>2020-02-13 22:53:36 +0300
commit303e2fdc598cbc82af401f12f3cc9169ed31598b (patch)
treef995ebea324b64ff3dbb54bae68533f319ed4828 /src/inspector_agent.cc
parentb32fa7bcc69aec0acb63792c799a22eeae7424c6 (diff)
src: wrap HostPort in ExclusiveAccess
I found it exceedingly hard to figure out if there is a race condition where one thread reads the inspector agent's HostPort's properties while another modifies them concurrently. I think the answer is "no, there isn't" but with this commit use sites are forced to unwrap the object (and acquire the mutex in the process), making it a great deal easier to reason about correctness. PR-URL: https://github.com/nodejs/node/pull/31717 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: David Carlier <devnexen@gmail.com>
Diffstat (limited to 'src/inspector_agent.cc')
-rw-r--r--src/inspector_agent.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc
index fe60c82cb55..b7ccf641c29 100644
--- a/src/inspector_agent.cc
+++ b/src/inspector_agent.cc
@@ -757,7 +757,7 @@ Agent::~Agent() {}
bool Agent::Start(const std::string& path,
const DebugOptions& options,
- std::shared_ptr<HostPort> host_port,
+ std::shared_ptr<ExclusiveAccess<HostPort>> host_port,
bool is_main) {
path_ = path;
debug_options_ = options;