|
|
|
|
|
by nyanpasu64
1063 days ago
|
|
Rust is a brilliant lesson in using traditional threading safely. It uses & for thread-shared types and constrains &mut to a single thread, which naturally causes people to keep single-threaded data on an object only accessible from a single thread, and make multithreaded data either immutable, mutex-protected, or atomic. Alternatively, message-passing isn't traditional threading, but Erlang/Go-style languages are another way to approach concurrency or parallelism. |
|
Rust does nothing to magically prevent race conditions for you. Rust safety does not encompass race conditions, starvation, etc.
What it does is defensively prevent you from sharing mutable variables without explicitly opting for it.
It's good for catching careless sharing issues, but not much more.