summaryrefslogtreecommitdiff
path: root/runtime/js
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-03-08 16:31:11 +0000
committerGitHub <noreply@github.com>2024-03-08 17:31:11 +0100
commit93b9d114a4c87402fa82c3f59d6509179f1fd126 (patch)
treea64492d0aae2d7bb6808ef6d57e1b454297e52ff /runtime/js
parentd5b01e41586c05d2af0bcf361ed4eadd03d60765 (diff)
refactor(ext/node): worker_threads.isMainThread setup (#22785)
This commit changes how we figure out if we're running on main thread in `node:worker_threads` module. Instead of relying on quirky "magic variable" for a name to check if we're on main thread, we are now explicitly passing this information during bootstrapping of the runtime. As a side effect, `WorkerOptions.name` is more useful and matches what Node.js does more closely (though not fully). Towards https://github.com/denoland/deno/issues/22783
Diffstat (limited to 'runtime/js')
-rw-r--r--runtime/js/99_main.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/runtime/js/99_main.js b/runtime/js/99_main.js
index 2299b63f9..82e444dfd 100644
--- a/runtime/js/99_main.js
+++ b/runtime/js/99_main.js
@@ -774,7 +774,7 @@ function bootstrapMainRuntime(runtimeOptions) {
ObjectDefineProperty(globalThis, "Deno", core.propReadOnly(finalDenoNs));
if (nodeBootstrap) {
- nodeBootstrap(hasNodeModulesDir, argv0);
+ nodeBootstrap(hasNodeModulesDir, argv0, /* runningOnMainThread */ true);
}
if (future) {
@@ -909,7 +909,7 @@ function bootstrapWorkerRuntime(
ObjectDefineProperty(globalThis, "Deno", core.propReadOnly(finalDenoNs));
if (nodeBootstrap) {
- nodeBootstrap(hasNodeModulesDir, argv0);
+ nodeBootstrap(hasNodeModulesDir, argv0, /* runningOnMainThread */ false);
}
}