3 ms·
Rust absolutely helps here because in Rust it’s simply impossible for someone else to mutate something concurrently to you holding a reference to it. Code equiv
by Sharlin 3y ago
Rust absolutely helps here because in Rust it’s simply impossible for someone else to mutate something concurrently to you holding a reference to it. Code equivalent to that in the article simply won’t compile in Rust. This is, like, the very point of Rust’s borrow system. You can share, xor you can mutate, but not both at the same time. This holds equally for single and multi-threaded code.
- ironmagma 3y agoIn safe Rust, that is. For unsafe Rust, I don't know exactly which bets are off but it's more than none.
- masklinn 3y agoIn unsafe rust this is a concurrent modification of an object with shared references, which is an UB.
- SpaghettiCthulu 3y agoUnless everyone is just holding pointers