Re:Data Race Patterns in Go
by oconnor663 on Sunday June 12, 2022 @12:43AM
(#31711511)
As an interesting example of doing something meaningful with relaxed arithmetic, Arc uses a relaxed fetch_add to increment the refcount: https://doc.rust-lang.org/src/alloc/sync.rs.html#1331-1343. Decrementing, however, uses acquire-release. Apparently shared_ptr in C++ is similar.
[ Parent
| on HN ]
Re:Data Race Patterns in Go
by tialaramex on Monday June 13, 2022 @08:46AM
(#31724733)
Tried to follow this link on my phone and the browser blew up, so I'll look when I'm home. Doubtless in both cases (Rust and C++) people who are much smarter than me have reasoned that it's correct and perhaps if I read the link I'll agree. But if you just asked me off the cuff my guess would have been this wasn't safe and so they should be Acquire-Release.