mirror of https://github.com/nodejs/node.git
doc: clarify Worker exit/message event ordering
Motivated by the fact that getting this wrong has led to flaky tests in our test suite. Refs: https://github.com/nodejs/node/pull/31637 PR-URL: https://github.com/nodejs/node/pull/31642 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>pull/31689/head
parent
aee3e2bc4c
commit
7df429808c
|
@ -584,6 +584,8 @@ exited by calling [`process.exit()`][], the `exitCode` parameter will be the
|
|||
passed exit code. If the worker was terminated, the `exitCode` parameter will
|
||||
be `1`.
|
||||
|
||||
This is the final event emitted by any `Worker` instance.
|
||||
|
||||
### Event: `'message'`
|
||||
<!-- YAML
|
||||
added: v10.5.0
|
||||
|
@ -595,6 +597,9 @@ The `'message'` event is emitted when the worker thread has invoked
|
|||
[`require('worker_threads').parentPort.postMessage()`][].
|
||||
See the [`port.on('message')`][] event for more details.
|
||||
|
||||
All messages sent from the worker thread will be emitted before the
|
||||
[`'exit'` event][] is emitted on the `Worker` object.
|
||||
|
||||
### Event: `'online'`
|
||||
<!-- YAML
|
||||
added: v10.5.0
|
||||
|
|
Loading…
Reference in New Issue