doc: add comments to empty blocks in worker_threads text
PR-URL: https://github.com/nodejs/node/pull/41831 Refs: https://eslint.org/docs/rules/no-empty Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
parent
8997bd8af2
commit
ee8c2bed8b
@ -1267,7 +1267,9 @@ import {
|
||||
|
||||
if (isMainThread) {
|
||||
new Worker(new URL(import.meta.url));
|
||||
for (let n = 0; n < 1e10; n++) {}
|
||||
for (let n = 0; n < 1e10; n++) {
|
||||
// Looping to simulate work.
|
||||
}
|
||||
} else {
|
||||
// This output will be blocked by the for loop in the main thread.
|
||||
console.log('foo');
|
||||
@ -1284,7 +1286,9 @@ const {
|
||||
|
||||
if (isMainThread) {
|
||||
new Worker(__filename);
|
||||
for (let n = 0; n < 1e10; n++) {}
|
||||
for (let n = 0; n < 1e10; n++) {
|
||||
// Looping to simulate work.
|
||||
}
|
||||
} else {
|
||||
// This output will be blocked by the for loop in the main thread.
|
||||
console.log('foo');
|
||||
|
Loading…
x
Reference in New Issue
Block a user