]> git.lizzy.rs Git - rust.git/commitdiff
Always align Waiter to 4 bytes
authorPaul Dicker <pitdicker@gmail.com>
Thu, 24 Oct 2019 15:08:23 +0000 (17:08 +0200)
committerPaul Dicker <pitdicker@gmail.com>
Thu, 24 Oct 2019 15:57:07 +0000 (17:57 +0200)
src/libstd/sync/once.rs

index 4c14fe75643a891d43060e8a28db41c80b3d6ba0..c135471e2f2ea3503869594b6ed8e44ead712025 100644 (file)
@@ -171,6 +171,7 @@ pub struct OnceState {
 // `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,