Re:Linux kernel in-tree Rust support
by fullstop on Saturday July 11, 2020 @12:22PM
(#23803274)
Does Rust handle anything with memory barriers? I can handle concurrency, interrupt handlers, etc, but memory barriers always trouble me.
[ Parent
| on HN ]
Re:Linux kernel in-tree Rust support
by steveklabnik on Saturday July 11, 2020 @12:55PM
(#23803557)
It will force your code to be memory safe, but it can't enforce that you have the correct semantics.
https://doc.rust-lang.org/std/sync/atomic/fn.fence.html exists, but Rust can't force you to say, use the correct ordering.
Right, so no different than C in this regard.
Really, you should rarely be using raw memory barriers even in C, IMO. The C11/C++11 atomics model (which Rust also uses) is substantially nicer. Though, unfortunately, still extremely tricky to get right.