3 ms·
I'm not sure what you're getting at. In no language is it sound to mutate the same data in parallel or to read it while it is being mutated. Synchronization pr
by unlinked_dll 7y ago
I'm not sure what you're getting at.
In no language is it sound to mutate the same data in parallel or to read it while it is being mutated. Synchronization primitives are needed by all languages to deal with this fundamental truth.
Rust just reflects this truth in the type system. That said, you can build whatever abstraction you want to deal with it. You can use immutable data structures, mutexes, lock/wait free mechanisms, whatever.
Hell you can throw caution to the wind and use a raw pointer if you wanted to. That's how a lot of the higher level constructs work under the hood, they just wrap the logic required to maintain soundness under the API. That's not just a Rust thing, it's true in all languages. It's just that Rust makes it a bit easier to express soundness because of how it reflects multiple aliasing in the type system.