▲ | BlackFly 2 days ago | |||||||
No, rust forces you to use a mutex but nothing will prevent you from making the mutex too small and creating tearing in your own data structures by sequentially modifying things covered by mutexes so that in between acquisition of the locks you are violating invariants. The borrow checker certainly helps however, but not without cost that was finally minimized when the scoped threads api came along. Java has a very specific memory model, so the behavior of variables across threads is quite well defined. Basic variables can tear however (a 64bit long on a 32bit architecture) without the volatile keyword and that is quite different than rust. | ||||||||
▲ | dontlaugh 2 days ago | parent [-] | |||||||
You didn’t describe any data races. What Rust prevents is very specific. | ||||||||
|