@@ -50,6 +50,10 @@ using v8::Uint32;
50
50
using v8::Uint32Array;
51
51
using v8::Value;
52
52
53
+ namespace per_process {
54
+ Mutex umask_mutex;
55
+ } // namespace per_process
56
+
53
57
// Microseconds in a second, as a float, used in CPUUsage() below
54
58
#define MICROS_PER_SEC 1e6
55
59
// used in Hrtime() below
@@ -220,6 +224,7 @@ static void Umask(const FunctionCallbackInfo<Value>& args) {
220
224
221
225
CHECK_EQ (args.Length (), 1 );
222
226
CHECK (args[0 ]->IsUndefined () || args[0 ]->IsUint32 ());
227
+ Mutex::ScopedLock scoped_lock (per_process::umask_mutex);
223
228
224
229
if (args[0 ]->IsUndefined ()) {
225
230
old = umask (0 );
@@ -396,9 +401,9 @@ static void InitializeProcessMethods(Local<Object> target,
396
401
target, " _stopProfilerIdleNotifier" , StopProfilerIdleNotifier);
397
402
env->SetMethod (target, " abort" , Abort);
398
403
env->SetMethod (target, " chdir" , Chdir);
399
- env->SetMethod (target, " umask" , Umask);
400
404
}
401
405
406
+ env->SetMethod (target, " umask" , Umask);
402
407
env->SetMethod (target, " _rawDebug" , RawDebug);
403
408
env->SetMethod (target, " memoryUsage" , MemoryUsage);
404
409
env->SetMethod (target, " cpuUsage" , CPUUsage);
0 commit comments