Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/api/embedding.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ pool completions of the other `node::Environment`s that become due in those
loop iterations run normally, including their JavaScript; only the
`node::Environment` being freed can no longer call into JavaScript.

Do not call `node::FreeEnvironment()` from a callback of the loop that it
runs. This includes timer and I/O callbacks, and JavaScript code or addon
functions that they run. A libuv loop must not run inside one of its own
callbacks. If you call `node::FreeEnvironment()` from such a callback, it can
wait forever. Call it after the loop stops running, for example after
`node::SpinEventLoop()` returns.

In order to set up a `v8::Isolate`, an `v8::ArrayBuffer::Allocator` needs
to be provided. One possible choice is the default Node.js allocator, which
can be created through `node::ArrayBufferAllocator::Create()`. Using the Node.js
Expand Down
3 changes: 2 additions & 1 deletion src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -926,7 +926,8 @@ NODE_EXTERN v8::MaybeLocal<v8::Value> LoadEnvironment(

// Runs `env`'s event loop until its handles have closed, with JavaScript
// execution disallowed for `env`; see doc/api/embedding.md if that loop is
// shared with other Environments.
// shared with other Environments. Do not call this from a callback of that
// loop, because uv_run() is not reentrant.
NODE_EXTERN void FreeEnvironment(Environment* env);

// Set a callback that is called when process.exit() is called from JS,
Expand Down