5 ms·
> The type system makes it impossible to mess up your usage of things like atomics and mutexes. You can still cause deadlocks and livelocks in well-typed code,
by cwzwarich 12y ago
> The type system makes it impossible to mess up your usage of things like atomics and mutexes.
You can still cause deadlocks and livelocks in well-typed code, which I put into the category of "messing up your usage of mutexes". It would take a more powerful type system to prevent these errors. It is also unclear whether the behavior of mutexes in the face of task failure is correct for all use cases.
- Ygg2 12y agoI think Rust prevents data races. That's pretty much the reason it has mutable variables. Compiler won't allow two places to borrow the same variable mutably.
- krenoten 12y agoI think what he meant is that the compiler gives you certain guarantees that in some cases will mean that you don't need to directly use atomics and mutexes at all. Rust still allows you to arbitrarily harm yourself, but it usually makes sure you are more clear about your intention to do so.