Skip to content

Comment on Node.js worker threads are problematic, but they work great for usparent

Comments

It's not ideal, the api is kind of low-yet-high-level and that brings some complications.

Move backpressure handling onto the task producer and use a SharedArrayBuffer between the producer and worker, where the worker atomically updates a work-count or current work item ID in that SharedArrayBuffer that the producer can read (atomically) to determine how far along the worker has gotten.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.