mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
src: add Environment overload of EmitAsyncDestroy
This can be necessary for being able to call the function when no JS Context is on the stack, e.g. during GC. Refs: https://github.com/nodejs/node/issues/27218 PR-URL: https://github.com/nodejs/node/pull/27255 Fixes: https://github.com/nodejs/node/issues/27218 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
This commit is contained in:
1 parent
7bc47cba2e
commit
809cf595eb
2 files changed
+13
-3
No files matched your search
+5
-2
@@ -130,8 +130,11 @@ async_context EmitAsyncInit(Isolate* isolate,
|
||||
}
|
||||
|
||||
void EmitAsyncDestroy(Isolate* isolate, async_context asyncContext) {
|
||||
AsyncWrap::EmitDestroy(
|
||||
Environment::GetCurrent(isolate), asyncContext.async_id);
|
||||
EmitAsyncDestroy(Environment::GetCurrent(isolate), asyncContext);
|
||||
}
|
||||
|
||||
void EmitAsyncDestroy(Environment* env, async_context asyncContext) {
|
||||
AsyncWrap::EmitDestroy(env, asyncContext.async_id);
|
||||
}
|
||||
|
||||
} // namespace node
|
||||
+8
-1
@@ -685,9 +685,16 @@ NODE_EXTERN async_context EmitAsyncInit(v8::Isolate* isolate,
|
||||
v8::Local<v8::String> name,
|
||||
async_id trigger_async_id = -1);
|
||||
|
||||
/* Emit the destroy() callback. */
|
||||
/* Emit the destroy() callback. The overload taking an `Environment*` argument
|
||||
* should be used when the Isolate’s current Context is not associated with
|
||||
* a Node.js Environment, or when there is no current Context, for example
|
||||
* when calling this function during garbage collection. In that case, the
|
||||
* `Environment*` value should have been acquired previously, e.g. through
|
||||
* `GetCurrentEnvironment()`. */
|
||||
NODE_EXTERN void EmitAsyncDestroy(v8::Isolate* isolate,
|
||||
async_context asyncContext);
|
||||
NODE_EXTERN void EmitAsyncDestroy(Environment* env,
|
||||
async_context asyncContext);
|
||||
|
||||
class InternalCallbackScope;
|
||||
|
||||
|
||||
Reference in new issue
Block a user