Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
codedokode
· 1y ago · 0 comments
How do you implement "commit" part safely (writing changes to the object) without locking the object?
Comments
[–]
titzer
1y ago
One way is that the writer thread prepares a completely new copy of the object in a private area and then either compare-and-swaps a pointer to it, or executes a store with a store-store barrier (depending on details of the STM system around it).
[–]
codedokode
OP
1y ago
Interesting, it's almost like immutable data structures.