File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
library/std/src/sys/sync/once Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ const POISONED: Primitive = 2;
1717/// so all future threads need to wait for it to finish.
1818const RUNNING : Primitive = 1 ;
1919/// Initialization has completed and all future calls should finish immediately.
20+ /// By choosing this state as the all-zero state the `is_completed` check can be
21+ /// a bit faster on some platforms.
2022const COMPLETE : Primitive = 0 ;
2123
2224// An additional bit indicates whether there are waiting threads:
Original file line number Diff line number Diff line change @@ -74,7 +74,8 @@ pub struct OnceState {
7474}
7575
7676// Four states that a Once can be in, encoded into the lower bits of
77- // `state_and_queue` in the Once structure.
77+ // `state_and_queue` in the Once structure. By choosing COMPLETE as the all-zero
78+ // state the `is_completed` check can be a bit faster on some platforms.
7879const INCOMPLETE : usize = 0x3 ;
7980const POISONED : usize = 0x2 ;
8081const RUNNING : usize = 0x1 ;
You can’t perform that action at this time.
0 commit comments