audreyt / node-webworker-threads

Lightweight Web Worker API implementation with native threads
https://npmjs.org/package/webworker-threads
Other
2.3k stars 149 forks source link

Test22 - don't run forever #145

Closed davisjam closed 6 years ago

davisjam commented 7 years ago
  1. Don't run forever.

Problem: It was creating an infinite number of threads. Solution: Create 1000 threads, enough to prove the point.

  1. Actually print ongoing updates.

Problem: It was using process.nextTick to queue the next set of threads. On recent versions of Node this means display() will never get to run.

Solution: Switch to setTimeout(again, 0).

This commit is toward #144 .