michaelwoerister / hamt-rs

A Persistent Map Implementation based on Hash Array Mapped Tries
174 stars 15 forks source link

Is it intended that HamtMap be Send/Sync? #13

Open TyOverby opened 7 years ago

TyOverby commented 7 years ago

As far as I can tell, right now it is neither.

rrichardson commented 7 years ago

I, too, am interested in being able to make updates (new copies) of the hamt while other threads are reading the data structure. Looking at the implementation, it doesn't appear that it was meant to be written-to and read concurrently. As I understand the persistent hamt implementation, one could maybe leverage hazard pointers at each node to represent the different versions of each subtree.

There is also https://github.com/ballard26/concurrent-hamt which might be a bit outdated, but leverages ideas from Bagwell and Odersky (Scala implementation) and hazard pointers.

Perhaps we can brutally plagarize the concurrent-hamt crate to make this one concurrency friendly. (or maybe it already is and I'm just dense)