diff options
author | cjihrig <cjihrig@gmail.com> | 2019-01-15 23:39:43 +0300 |
---|---|---|
committer | cjihrig <cjihrig@gmail.com> | 2019-01-18 00:32:21 +0300 |
commit | f6cd4e3e5976ce9edccdb13933028bdc95d43df4 (patch) | |
tree | 4eb1583e5776f3b544e4096e67b72d54cbca28ef /src/node_process_methods.cc | |
parent | 1375af204a30d1885b9e8bf79725cbd223707439 (diff) |
process: allow reading umask in workers
Refs: https://github.com/nodejs/node/issues/25448
PR-URL: https://github.com/nodejs/node/pull/25526
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/node_process_methods.cc')
-rw-r--r-- | src/node_process_methods.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index c9abe19b7e0..51758f05f6b 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -50,6 +50,10 @@ using v8::Uint32; using v8::Uint32Array; using v8::Value; +namespace per_process { +Mutex umask_mutex; +} // namespace per_process + // Microseconds in a second, as a float, used in CPUUsage() below #define MICROS_PER_SEC 1e6 // used in Hrtime() below @@ -220,6 +224,7 @@ static void Umask(const FunctionCallbackInfo<Value>& args) { CHECK_EQ(args.Length(), 1); CHECK(args[0]->IsUndefined() || args[0]->IsUint32()); + Mutex::ScopedLock scoped_lock(per_process::umask_mutex); if (args[0]->IsUndefined()) { old = umask(0); @@ -396,9 +401,9 @@ static void InitializeProcessMethods(Local<Object> target, target, "_stopProfilerIdleNotifier", StopProfilerIdleNotifier); env->SetMethod(target, "abort", Abort); env->SetMethod(target, "chdir", Chdir); - env->SetMethod(target, "umask", Umask); } + env->SetMethod(target, "umask", Umask); env->SetMethod(target, "_rawDebug", RawDebug); env->SetMethod(target, "memoryUsage", MemoryUsage); env->SetMethod(target, "cpuUsage", CPUUsage); |