File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1846,6 +1846,14 @@ Calling `unref()` on a worker allows the thread to exit if this is the only
18461846active handle in the event system . If the worker is already ` unref()` ed calling
18471847` unref()` again has no effect.
18481848
1849+ ### ` worker[Symbol.asyncDispose]()`
1850+
1851+ <!-- YAML
1852+ added: REPLACEME
1853+ -->
1854+
1855+ Alias for [` worker.terminate()` ][].
1856+
18491857## Notes
18501858
18511859### Synchronous blocking of stdio
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ const {
5858const { createMainThreadPort, destroyMainThreadPort } = require ( 'internal/worker/messaging' ) ;
5959const { deserializeError } = require ( 'internal/error_serdes' ) ;
6060const { fileURLToPath, isURL, pathToFileURL } = require ( 'internal/url' ) ;
61- const { kEmptyObject } = require ( 'internal/util' ) ;
61+ const { kEmptyObject, SymbolAsyncDispose } = require ( 'internal/util' ) ;
6262const { validateArray, validateString } = require ( 'internal/validators' ) ;
6363const {
6464 throwIfBuildingSnapshot,
@@ -406,6 +406,10 @@ class Worker extends EventEmitter {
406406 } ) ;
407407 }
408408
409+ async [ SymbolAsyncDispose ] ( ) {
410+ await this . terminate ( ) ;
411+ }
412+
409413 ref ( ) {
410414 if ( this [ kHandle ] === null ) return ;
411415
You can’t perform that action at this time.
0 commit comments