[Proposal] - Thead Safe data structures #55568
Labels
feature request
Issues that request new features to be added to Node.js.
worker
Issues and PRs related to Worker support.
What is the problem this feature will solve?
What I'd like to achieve is an implementation of shared (between worker threads) and thread safe data structures.
I want something easier to work with when doing multithread nodejs. Sharing data between threads using SharedArrayBuffer can be hard sometimes.
What is the feature you are proposing to solve the problem?
I'll show you an example of what the API usage could look like for a data structure like LRU Cache:
This is the code in the main thread
this is the worker code:
I started working into an implementation that uses extensively SharedArrayBuffer and Atomics to reach thread safety but there are lots of problems to take into consideration like:
Do you guys think it's a useful feature and worth implementing or taking it into consideration?
What alternatives have you considered?
No response
The text was updated successfully, but these errors were encountered: