Skip to content
Closed
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions doc/api/worker_threads.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ if (isMainThread) {
The above example spawns a Worker thread for each `parse()` call. In actual
practice, use a pool of Workers instead for these kinds of tasks. Otherwise, the
overhead of creating Workers would likely exceed their benefit.
When implementing a worker pool, it is strongly recommended to use the
Comment thread
addaleax marked this conversation as resolved.
Resolved
[`AsyncResource`][] API to inform diagnostic tools (for e.g. asynchronous stack

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: for e.g. should be either for example or e.g., although I would go with such as:

Suggested change
[`AsyncResource`][] API to inform diagnostic tools (for e.g. asynchronous stack
[`AsyncResource`][] API to inform diagnostic tools (such as asynchronous stack

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Trott I don’t think for example or just e.g. would work here, as asynchronous stack traces aren’t diagnostic tools by themselves, but rather provided by them. I’ve changed this to e.g. in order to provide asynchronous stack traces, maybe that works for you?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, that's great.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Total ignorable nit: Maybe drop "in order"?)

traces) about the correlation between tasks and their outcomes.

## worker.isMainThread
<!-- YAML
Expand Down Expand Up @@ -653,6 +656,7 @@ active handle in the event system. If the worker is already `unref()`ed calling
`unref()` again will have no effect.

[`'close'` event]: #worker_threads_event_close
[`AsyncResource`]: async_hooks.html#async_hooks_class_asyncresource
[`Buffer`]: buffer.html
[`EventEmitter`]: events.html
[`EventTarget`]: https://developer.mozilla.org/en-US/docs/Web/API/EventTarget
Expand Down