diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2019-01-01 08:56:53 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-01-08 02:28:16 +0300 |
commit | 9db9e7e541c1ff9a30b7f1b61c6d3a7b6d30fab3 (patch) | |
tree | f16cfd671dd32467ae0cc221335118733c09030a /src/util.h | |
parent | ae2d1f0e05449221ee770a393e5c967b359d9b1b (diff) |
src: move per-process global variables into node::per_process
So that it's easier to tell whether we are manipulating per-process
global states that may need to be treated with care to avoid races.
Also added comments about these variables and moved some of them
to a more suitable compilation unit:
- Move `v8_initialized` to `util.h` since it's only used in
`util.cc` and `node.cc`
- Rename `process_mutex` to `tty_mutex` and move it into
`node_errors.cc` since that's the only place it's used
to guard the tty.
- Move `per_process_opts_mutex` and `per_process_opts`
into `node_options.h` and rename them to
`per_process::cli_options[_mutex]`
- Rename `node_isolate[_mutex]` to `per_process::main_isolate[_mutex]`
PR-URL: https://github.com/nodejs/node/pull/25302
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h index ffa5a308a77..1205f2d06b1 100644 --- a/src/util.h +++ b/src/util.h @@ -74,6 +74,12 @@ inline char* UncheckedCalloc(size_t n); template <typename T> inline T MultiplyWithOverflowCheck(T a, T b); +namespace per_process { +// Tells whether the per-process V8::Initialize() is called and +// if it is safe to call v8::Isolate::GetCurrent(). +extern bool v8_initialized; +} // namespace per_process + // Used by the allocation functions when allocation fails. // Thin wrapper around v8::Isolate::LowMemoryNotification() that checks // whether V8 is initialized. |