diff options
author | Anna Henningsen <anna@addaleax.net> | 2020-07-11 02:59:21 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2020-07-14 16:07:20 +0300 |
commit | 725cf4764acb515be56b5e414b62f4cf92cf8ecd (patch) | |
tree | 96d93feb5bf2395e41b8bcddc2ad7fa6357f2ffb /doc/api/worker_threads.md | |
parent | b58c06d92c3865b41a50171c2692e36c0b487420 (diff) |
worker: add option to track unmanaged file descriptors
Add a public option for Workers which adds tracking for raw
file descriptors, as currently, those resources are not cleaned
up, unlike e.g. `FileHandle`s.
PR-URL: https://github.com/nodejs/node/pull/34303
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Diffstat (limited to 'doc/api/worker_threads.md')
-rw-r--r-- | doc/api/worker_threads.md | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/api/worker_threads.md b/doc/api/worker_threads.md index 38167bfd0bf..7dd74675585 100644 --- a/doc/api/worker_threads.md +++ b/doc/api/worker_threads.md @@ -621,6 +621,10 @@ if (isMainThread) { added: v10.5.0 changes: - version: + - REPLACEME + pr-url: ??? + description: The `trackUnmanagedFds` option was introduced. + - version: - v13.13.0 - v12.17.0 pr-url: https://github.com/nodejs/node/pull/32278 @@ -679,6 +683,12 @@ changes: occur as described in the [HTML structured clone algorithm][], and an error will be thrown if the object cannot be cloned (e.g. because it contains `function`s). + * `trackUnmanagedFds` {boolean} If this is set to `true`, then the Worker will + track raw file descriptors managed through [`fs.open()`][] and + [`fs.close()`][], and close them when the Worker exits, similar to other + resources like network sockets or file descriptors managed through + the [`FileHandle`][] API. This option is automatically inherited by all + nested `Worker`s. **Default**: `false`. * `transferList` {Object[]} If one or more `MessagePort`-like objects are passed in `workerData`, a `transferList` is required for those items or [`ERR_MISSING_MESSAGE_PORT_IN_TRANSFER_LIST`][] will be thrown. @@ -900,6 +910,8 @@ active handle in the event system. If the worker is already `unref()`ed calling [`WebAssembly.Module`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module [`Worker`]: #worker_threads_class_worker [`cluster` module]: cluster.html +[`fs.open()`]: fs.html#fs_fs_open_path_flags_mode_callback +[`fs.close()`]: fs.html#fs_fs_close_fd_callback [`markAsUntransferable()`]: #worker_threads_worker_markasuntransferable_object [`port.on('message')`]: #worker_threads_event_message [`port.onmessage()`]: https://developer.mozilla.org/en-US/docs/Web/API/MessagePort/onmessage |