Crust of Rust: Atomics and Memory Ordering
Video Statistics and Information
Channel: Jon Gjengset
Views: 27,281
Rating: 4.9909296 out of 5
Keywords: rust, live-coding, atomics, memory ordering
Id: rMGWeSjctlY
Channel Id: undefined
Length: 159min 20sec (9560 seconds)
Published: Fri Apr 02 2021
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.
u/jonhoo Thank you for taking the time to go through this. I've read through the docs, but having it explained like this helps cement it.
I'm a bit sad that rust accepts
Ordering
values that don't make sense. For example, thestore
methods on atomic types panic if you pass inAcquire
orAcqRel
orderings. Why couldn't rust have defined a separate enum here so it isn't possible to pass in semantically wrong orderings? Seems like it would be more consistent with the way the rest of std is usually built. A compile-time error is better than a runtime panic.After watching with interest (Thanks!): fence documentation in the cppreference is here:
atomic_thread_fence
A question I had while watching:
Why does compare_exchange return
Result<usize, usize>
instead ofResult<(), usize>
? In the success case we already know the previous value since we passed it, why does the function need to return it again?Does anyone know what his vim config is, which vim plugin does he use with rust-analyzer?