Always align Waiter to 4 bytes

This commit is contained in:
Paul Dicker 2019-10-24 17:08:23 +02:00
parent c11a44ab6c
commit c2bbfeadcc

View file

@ -171,6 +171,7 @@ const STATE_MASK: usize = 0x3;
// `wait` would both hand out a mutable reference to its `Waiter` node, and keep
// a shared reference to check `signaled`. Instead we hold shared references and
// use interior mutability.
#[repr(align(4))] // Ensure the two lower bits are free to use as state bits.
struct Waiter {
thread: Cell<Option<Thread>>,
signaled: AtomicBool,