andywer / threads.js

🧵 Make web workers & worker threads as simple as a function call.
https://threads.js.org/
MIT License
3.04k stars 161 forks source link

feature request: support "pinning" tasks to workers #480

Open johanatan opened 11 months ago

johanatan commented 11 months ago

When workers are spawned, allow specifying a "key" (string) for each. When tasks are queued, accept a zero arity function returning a key. If the key returned matches any of the keys supplied when the workers were spawned, ensure that the task is scheduled on the matching worker.