worker: add postMessageToThread

PR-URL: https://github.com/nodejs/node/pull/53682
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
Paolo Insogna authored and Antoine du Hamel committed 2024-07-16 12:01:15 +02:00
1 parent 5ae8ea489d
commit 22ca334090
14 files changed
+677 -5

No files matched your search

+49
View File
@@ -3105,6 +3105,54 @@ The `Worker` instance terminated because it reached its memory limit.
The path for the main script of a worker is neither an absolute path
nor a relative path starting with `./` or `../`.
<a id="ERR_WORKER_MESSAGING_ERRORED"></a>
### `ERR_WORKER_MESSAGING_ERRORED`
<!-- YAML
added: REPLACEME
-->
> Stability: 1.1 - Active development
The destination thread threw an error while processing a message sent via [`postMessageToThread()`][].
<a id="ERR_WORKER_MESSAGING_FAILED"></a>
### `ERR_WORKER_MESSAGING_FAILED`
<!-- YAML
added: REPLACEME
-->
> Stability: 1.1 - Active development
The thread requested in [`postMessageToThread()`][] is invalid or has no `workerMessage` listener.
<a id="ERR_WORKER_MESSAGING_SAME_THREAD"></a>
### `ERR_WORKER_MESSAGING_SAME_THREAD`
<!-- YAML
added: REPLACEME
-->
> Stability: 1.1 - Active development
The thread id requested in [`postMessageToThread()`][] is the current thread id.
<a id="ERR_WORKER_MESSAGING_TIMEOUT"></a>
### `ERR_WORKER_MESSAGING_TIMEOUT`
<!-- YAML
added: REPLACEME
-->
> Stability: 1.1 - Active development
Sending a message via [`postMessageToThread()`][] timed out.
<a id="ERR_WORKER_UNSERIALIZABLE_ERROR"></a>
### `ERR_WORKER_UNSERIALIZABLE_ERROR`
@@ -4017,6 +4065,7 @@ An error occurred trying to allocate memory. This should never happen.
[`new URLSearchParams(iterable)`]: url.md#new-urlsearchparamsiterable
[`package.json`]: packages.md#nodejs-packagejson-field-definitions
[`postMessage()`]: worker_threads.md#portpostmessagevalue-transferlist
[`postMessageToThread()`]: worker_threads.md#workerpostmessagetothreadthreadid-value-transferlist-timeout
[`process.on('exit')`]: process.md#event-exit
[`process.send()`]: process.md#processsendmessage-sendhandle-options-callback
[`process.setUncaughtExceptionCaptureCallback()`]: process.md#processsetuncaughtexceptioncapturecallbackfn