From d35af56e5f3b1334c4360dbf8a013d0c522fe5f8 Mon Sep 17 00:00:00 2001 From: Gireesh Punathil Date: Tue, 12 Jun 2018 09:01:46 -0400 Subject: src: shutdown node in-flight This commit introduces a `node::Stop()` API. An identified use case for embedders is their ability to tear down Node while it is still running (event loop contain pending events) Here the assumptions are that (i) embedders do not wish to resort to JS routines to initiate shutdown (ii) embedders have the Environment handle handy. (iii) embedders stop Node through a second thread. Fixes: https://github.com/nodejs/node/issues/19365 Refs: https://github.com/nodejs/user-feedback/issues/51 PR-URL: https://github.com/nodejs/node/pull/21283 Reviewed-By: Anna Henningsen Reviewed-By: Richard Lau Reviewed-By: Michael Dawson --- src/module_wrap.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/module_wrap.cc') diff --git a/src/module_wrap.cc b/src/module_wrap.cc index d311f7caca..ac5d28fb23 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -302,7 +302,7 @@ void ModuleWrap::Evaluate(const FunctionCallbackInfo& args) { // Convert the termination exception into a regular exception. if (timed_out || received_signal) { - if (!env->is_main_thread() && env->is_stopping_worker()) + if (!env->is_main_thread() && env->is_stopping()) return; env->isolate()->CancelTerminateExecution(); // It is possible that execution was terminated by another timeout in -- cgit v1.2.3