Skip to content

Commit

Permalink
use isMainThread
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonBall committed Jan 4, 2022
1 parent adcf374 commit 73e0b71
Showing 1 changed file with 2 additions and 4 deletions.
@@ -1,8 +1,6 @@
import { Worker } from 'worker_threads';
import { Worker, isMainThread } from 'worker_threads';

// Do not use isMainThread so that this test itself can be run inside a Worker.
if (!process.env.HAS_STARTED_WORKER) {
process.env.HAS_STARTED_WORKER = 1;
if (isMainThread) {
new Worker(new URL(import.meta.url));
await new Promise(() => {});
} else {
Expand Down

0 comments on commit 73e0b71

Please sign in to comment.