| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent dab64bb commit 441b545
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -5,6 +5,8 @@ const { Worker } = require('worker_threads'); | |||
| 5 | 5 | // Check that worker.unref() makes the 'exit' event not be emitted, if it is | |
| 6 | 6 | // the only thing we would otherwise be waiting for. | |
| 7 | 7 | ||
| 8 | - const w = new Worker('', { eval: true }); | ||
| 8 | + // Use `setInterval()` to make sure the worker is alive until the end of the | ||
| 9 | + // event loop turn. | ||
| 10 | + const w = new Worker('setInterval(() => {}, 100);', { eval: true }); | ||
| 9 | 11 | w.unref(); | |
| 10 | 12 | w.on('exit', common.mustNotCall()); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments