relax.rs 292 B

1234567891011121314151617
  1. pub trait Relax {
  2. fn relax();
  3. }
  4. #[derive(Default, Debug, Clone, Copy)]
  5. pub struct LoopRelax;
  6. impl Relax for LoopRelax {
  7. fn relax() {}
  8. }
  9. #[derive(Default, Debug, Clone, Copy)]
  10. pub struct SpinRelax;
  11. impl Relax for SpinRelax {
  12. fn relax() {
  13. core::hint::spin_loop();
  14. }
  15. }