summaryrefslogtreecommitdiff
path: root/src/node_internals.h
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2019-01-01 13:56:53 +0800
committerAnna Henningsen <anna@addaleax.net>2019-01-08 00:28:16 +0100
commit9db9e7e541c1ff9a30b7f1b61c6d3a7b6d30fab3 (patch)
treef16cfd671dd32467ae0cc221335118733c09030a /src/node_internals.h
parentae2d1f0e05449221ee770a393e5c967b359d9b1b (diff)
downloadandroid-node-v8-9db9e7e541c1ff9a30b7f1b61c6d3a7b6d30fab3.tar.gz
android-node-v8-9db9e7e541c1ff9a30b7f1b61c6d3a7b6d30fab3.tar.bz2
android-node-v8-9db9e7e541c1ff9a30b7f1b61c6d3a7b6d30fab3.zip
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/node_internals.h')
-rw-r--r--src/node_internals.h14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/node_internals.h b/src/node_internals.h
index 4ed75385f9..f9ef31eea5 100644
--- a/src/node_internals.h
+++ b/src/node_internals.h
@@ -83,14 +83,10 @@ namespace native_module {
class NativeModuleLoader;
}
-extern Mutex process_mutex;
-extern Mutex environ_mutex;
-
-// Tells whether it is safe to call v8::Isolate::GetCurrent().
-extern bool v8_initialized;
-
-extern Mutex per_process_opts_mutex;
-extern std::shared_ptr<PerProcessOptions> per_process_opts;
+namespace per_process {
+extern Mutex env_var_mutex;
+extern double prog_start_time;
+} // namespace per_process
// Forward declaration
class Environment;
@@ -699,8 +695,6 @@ static inline const char* errno_string(int errorno) {
// Functions defined in node.cc that are exposed via the bootstrapper object
-extern double prog_start_time;
-
void RawDebug(const v8::FunctionCallbackInfo<v8::Value>& args);
void DebugPortGetter(v8::Local<v8::Name> property,