Skip to content

While loop only run once inside worker thread #72

@issadarkthing

Description

@issadarkthing

I played around with this library a bit to see how easy it is to use a worker thread. Whilst I was using it, I stumbled upon weird behavior where the while loop only run once inside the worker thread. Here is the minimal example to reproduce:

import { start, job } from "microjob";

(async () => {

  try {
    // start worker pool
    await start({ maxWorkers: 4 }); // you can also limit the available workers

    job(() => {
      while (true) {
        console.log("inside loop")
      }
    })

    // ...
  } catch (err) {
    console.error(err);
  }
})();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions