File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed 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
1846
1846
active handle in the event system . If the worker is already ` unref()` ed calling
1847
1847
` unref()` again has no effect.
1848
1848
1849
+ ### ` worker[Symbol.asyncDispose]()`
1850
+
1851
+ <!-- YAML
1852
+ added: REPLACEME
1853
+ -->
1854
+
1855
+ Alias for [` worker.terminate()` ][].
1856
+
1849
1857
## Notes
1850
1858
1851
1859
### Synchronous blocking of stdio
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ const {
58
58
const { createMainThreadPort, destroyMainThreadPort } = require ( 'internal/worker/messaging' ) ;
59
59
const { deserializeError } = require ( 'internal/error_serdes' ) ;
60
60
const { fileURLToPath, isURL, pathToFileURL } = require ( 'internal/url' ) ;
61
- const { kEmptyObject } = require ( 'internal/util' ) ;
61
+ const { kEmptyObject, SymbolAsyncDispose } = require ( 'internal/util' ) ;
62
62
const { validateArray, validateString } = require ( 'internal/validators' ) ;
63
63
const {
64
64
throwIfBuildingSnapshot,
@@ -406,6 +406,10 @@ class Worker extends EventEmitter {
406
406
} ) ;
407
407
}
408
408
409
+ async [ SymbolAsyncDispose ] ( ) {
410
+ await this . terminate ( ) ;
411
+ }
412
+
409
413
ref ( ) {
410
414
if ( this [ kHandle ] === null ) return ;
411
415
You can’t perform that action at this time.
0 commit comments