diff options
author | Daniel Bevenius <daniel.bevenius@gmail.com> | 2017-03-21 08:06:43 +0100 |
---|---|---|
committer | Daniel Bevenius <daniel.bevenius@gmail.com> | 2017-04-12 13:11:39 +0200 |
commit | ec53921d2e96b4fd7672f69187f6b45b0ab96310 (patch) | |
tree | ec8f10b5f5fddc67679bfdeda40d8f0fd1943166 /src/node.h | |
parent | de168b4b4a4a8b8bd765a99bfa735d51f2650961 (diff) | |
download | android-node-v8-ec53921d2e96b4fd7672f69187f6b45b0ab96310.tar.gz android-node-v8-ec53921d2e96b4fd7672f69187f6b45b0ab96310.tar.bz2 android-node-v8-ec53921d2e96b4fd7672f69187f6b45b0ab96310.zip |
src: make AtExit callback's per Environment
This commit attempts to address one of the TODOs in
https://github.com/nodejs/node/issues/4641 regarding making the
AtExit callback's per environment, instead of the current global.
bnoordhuis provided a few options for solving this, and one was to
use a thread-local which is what this commit attempts to do.
PR-URL: https://github.com/nodejs/node/pull/9163
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/node.h')
-rw-r--r-- | src/node.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/node.h b/src/node.h index e0988649f4..4452b9d578 100644 --- a/src/node.h +++ b/src/node.h @@ -511,6 +511,12 @@ extern "C" NODE_EXTERN void node_module_register(void* mod); */ NODE_EXTERN void AtExit(void (*cb)(void* arg), void* arg = 0); +/* Registers a callback with the passed-in Environment instance. The callback + * is called after the event loop exits, but before the VM is disposed. + * Callbacks are run in reverse order of registration, i.e. newest first. + */ +NODE_EXTERN void AtExit(Environment* env, void (*cb)(void* arg), void* arg = 0); + } // namespace node #endif // SRC_NODE_H_ |