diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-06-06 00:30:05 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-06-08 01:16:03 +0200 |
commit | 505bfdc7e4fc4f914ceca019706dbf06901dd361 (patch) | |
tree | ecb4d220b2c230771ee112528f9d004f6b1a6d28 /src/node_platform.h | |
parent | 977d0111b59175f1647bcd24241f77e0fb466321 (diff) | |
download | node-new-505bfdc7e4fc4f914ceca019706dbf06901dd361.tar.gz |
src: add consistency check to node_platform.cc
We use the `Isolate*` pointer as the sole identifier
for a V8 Isolate. In some environments (e.g. multi-threaded),
Isolates may be destroyed and new ones created; then, it
may happen that the memory that was previously used for
one `Isolate` can be re-used for another `Isolate`
after the first one has been disposed of.
This check is a little guard against accidentally
re-using the same per-Isolate platform data structure
in such cases, i.e. making sure (to the degree to which
that is possible) that the old `Isolate*` has been properly
unregistered before one at the same memory address is added.
(It’s not 100 % foolproof because the `uv_loop_t*`
pointer value could theoretically be the same as well.)
PR-URL: https://github.com/nodejs/node/pull/21156
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'src/node_platform.h')
-rw-r--r-- | src/node_platform.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/node_platform.h b/src/node_platform.h index cf0809ad1f..f6a177c924 100644 --- a/src/node_platform.h +++ b/src/node_platform.h @@ -72,6 +72,8 @@ class PerIsolatePlatformData : bool FlushForegroundTasksInternal(); void CancelPendingDelayedTasks(); + const uv_loop_t* event_loop() const { return loop_; } + private: void DeleteFromScheduledTasks(DelayedTask* task); |