3 ms·
Rust does disallow you from doing some kinds of unsafe operations between threads, unless you explicitly opt in. That said, unsafe is not generally more conven
by steveklabnik 8y ago
Rust does disallow you from doing some kinds of unsafe operations between threads, unless you explicitly opt in.
That said, unsafe is not generally more convenient than safe and so people empirically don’t do this in the first place.
- amelius 8y agoLet me ask you then: would you use a Rust library in multithreaded code, without checking if that library is thread-safe? Wouldn't you like your compiler to tell you?
- steveklabnik 8y agoAll the time. The compiler does tell you if it’s thread safe. That’s the point.
- GolDDranks 8y agoThere is so called marker traits Send and Sync that are used to track whether something is tread-safe or not. https://doc.rust-lang.org/beta/nomicon/send-and-sync.html https://doc.rust-lang.org/beta/nomicon/send-and-sync.html Regardless of whether you use unsafe or not, thread safety is tracked with these and they allow the compiler to detect and prohibit data races.