summaryrefslogtreecommitdiff
path: root/src/node.h
diff options
context:
space:
mode:
authorGireesh Punathil <gpunathi@in.ibm.com>2018-06-12 09:01:46 -0400
committerGireesh Punathil <gpunathi@in.ibm.com>2019-03-16 12:50:26 +0530
commitd35af56e5f3b1334c4360dbf8a013d0c522fe5f8 (patch)
treea6f9bb5467ec693c04d6741c3704a7c80a4eb482 /src/node.h
parent22de2cfb71f3f1ab63e9663f4aa62bd9016b762a (diff)
downloadnode-new-d35af56e5f3b1334c4360dbf8a013d0c522fe5f8.tar.gz
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 <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Michael Dawson <Michael_Dawson@ca.ibm.com>
Diffstat (limited to 'src/node.h')
-rw-r--r--src/node.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/node.h b/src/node.h
index 17eae72e9c..6568085335 100644
--- a/src/node.h
+++ b/src/node.h
@@ -201,10 +201,17 @@ typedef intptr_t ssize_t;
namespace node {
+class IsolateData;
+class Environment;
+
// TODO(addaleax): Officially deprecate this and replace it with something
// better suited for a public embedder API.
NODE_EXTERN int Start(int argc, char* argv[]);
+// Tear down Node.js while it is running (there are active handles
+// in the loop and / or actively executing JavaScript code).
+NODE_EXTERN int Stop(Environment* env);
+
// TODO(addaleax): Officially deprecate this and replace it with something
// better suited for a public embedder API.
NODE_EXTERN void Init(int* argc,
@@ -239,9 +246,6 @@ class NODE_EXTERN ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
NODE_EXTERN ArrayBufferAllocator* CreateArrayBufferAllocator();
NODE_EXTERN void FreeArrayBufferAllocator(ArrayBufferAllocator* allocator);
-class IsolateData;
-class Environment;
-
class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {
public:
~MultiIsolatePlatform() override { }