4 ms·
Definition of data race on that page is very limited. Also on the same page "Data races are mostly prevented through Rust's ownership system".
by Sankozi 4y ago
Definition of data race on that page is very limited.
Also on the same page "Data races are mostly prevented through Rust's ownership system".
- kaba0 4y agoRust does prevent data races (as in multiple threads writing to the same memory location is explicitly forbidden by the borrow checker), but it doesn’t prevent race conditions, which is a more general family of concurrency bugs. In short, the borrow checker allows a single owner at all times, or it allows references to the object, abiding these rules: it may have any number of read-only references (they are safe to share), OR a single read-write reference.