diff --git a/src/node.cc b/src/node.cc index cbef51960a4ebe..b4dd1a7da96277 100644 --- a/src/node.cc +++ b/src/node.cc @@ -608,9 +608,14 @@ int ProcessGlobalArgs(std::vector* args, return 0; } +static std::atomic_bool init_called{false}; + int Init(std::vector* argv, std::vector* exec_argv, std::vector* errors) { + // Make sure Init() is called only once. + CHECK(!init_called.exchange(true)); + // Register built-in modules binding::RegisterBuiltinModules();