summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/02_init.js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-03-11 22:18:03 +0000
committerGitHub <noreply@github.com>2024-03-11 23:18:03 +0100
commitd69aab62b0789dd54b8c09b54af022a38f060b5b (patch)
treee99a5a3217d6aeee379bc592bfa33702dc2d6de8 /ext/node/polyfills/02_init.js
parent28b362adfc49324e20af5ecb1530f89eb91c4ed5 (diff)
fix(ext/node): make worker setup synchronous (#22815)
This commit fixes race condition in "node:worker_threads" module were the first message did a setup of "threadId", "workerData" and "environmentData". Now this data is passed explicitly during workers creation and is set up before any user code is executed. Closes https://github.com/denoland/deno/issues/22783 Closes https://github.com/denoland/deno/issues/22672 --------- Co-authored-by: Satya Rohith <me@satyarohith.com>
Diffstat (limited to 'ext/node/polyfills/02_init.js')
-rw-r--r--ext/node/polyfills/02_init.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/node/polyfills/02_init.js b/ext/node/polyfills/02_init.js
index 84f8a7cdc..04820b837 100644
--- a/ext/node/polyfills/02_init.js
+++ b/ext/node/polyfills/02_init.js
@@ -14,6 +14,7 @@ function initialize(
usesLocalNodeModulesDir,
argv0,
runningOnMainThread,
+ maybeWorkerMetadata,
) {
if (initialized) {
throw Error("Node runtime already initialized");
@@ -38,7 +39,7 @@ function initialize(
// FIXME(bartlomieju): not nice to depend on `Deno` namespace here
// but it's the only way to get `args` and `version` and this point.
internals.__bootstrapNodeProcess(argv0, Deno.args, Deno.version);
- internals.__initWorkerThreads(runningOnMainThread);
+ internals.__initWorkerThreads(runningOnMainThread, maybeWorkerMetadata);
internals.__setupChildProcessIpcChannel();
// `Deno[Deno.internal].requireImpl` will be unreachable after this line.
delete internals.requireImpl;