diff options
| author | Satya Rohith <me@satyarohith.com> | 2024-03-13 22:52:25 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-13 17:22:25 +0000 |
| commit | 0fd8f549e2194223eca2d4b17f4e96cd5a0f5fd5 (patch) | |
| tree | 76181b2a5f2991134f7343cfc6d4b8b755dbc333 /runtime/js/11_workers.js | |
| parent | b3ca3b2f25931afb350027bde87dc3d4f9a741b0 (diff) | |
fix(ext/node): allow automatic worker_thread termination (#22647)
Co-authored-by: Matt Mastracci <matthew@mastracci.com>
Diffstat (limited to 'runtime/js/11_workers.js')
| -rw-r--r-- | runtime/js/11_workers.js | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/runtime/js/11_workers.js b/runtime/js/11_workers.js index 15bbad101..5d24df93d 100644 --- a/runtime/js/11_workers.js +++ b/runtime/js/11_workers.js @@ -46,6 +46,7 @@ function createWorker( permissions, name, workerType, + closeOnIdle, ) { return op_create_worker({ hasSourceCode, @@ -54,6 +55,7 @@ function createWorker( sourceCode, specifier, workerType, + closeOnIdle, }); } @@ -75,14 +77,6 @@ function hostRecvMessage(id) { const privateWorkerRef = Symbol(); -function refWorker(worker) { - worker[privateWorkerRef](true); -} - -function unrefWorker(worker) { - worker[privateWorkerRef](false); -} - class Worker extends EventTarget { #id = 0; #name = ""; @@ -134,8 +128,9 @@ class Worker extends EventTarget { hasSourceCode, sourceCode, deno?.permissions, - name, + this.#name, workerType, + false, ); this.#id = id; this.#pollControl(); @@ -325,4 +320,4 @@ webidl.converters["WorkerType"] = webidl.createEnumConverter("WorkerType", [ "module", ]); -export { refWorker, unrefWorker, Worker }; +export { Worker }; |
