bevy/crates
Zachary Harrold 99289ad988
Add sleep based on spin to bevy_platform_support (#18633)
# Objective

- Fixes #18617

## Solution

- Added `thread::sleep` to `bevy_platform_support` using a spin-based
fallback.
- Fixed bug in `bevy_platform_support::time::Instant::elapsed`
(comparison was backwards)
- Switched `ScheduleRunnerPlugin` to use
`bevy_platform_support:🧵:sleep` on `std` and `no_std` platforms
(WASM + Browser excluded)

## Testing

- Ran reproduction code from @mockersf in linked issue and confirmed a
consistent 60 counts per `println!`.

---

## Notes

- I chose to add `bevy_platform_support:🧵:sleep` instead of
putting the fix in-line within `ScheduleRunnerPlugin` to keep the
separation of concerns clean. `sleep` is only used in one other location
in Bevy, `bevy_asset`, but I have decided to leave that as-is since
`bevy_asset` isn't `no_std` compatible anyway.
- The bug in `bevy_platform_support::time::Instant::elapsed` wasn't the
cause of this issue, but it did prevent this fix from working so I have
included the it in this PR.
2025-03-31 23:21:49 +00:00
..
bevy_a11y Update accesskit and accesskit_winit requirements (#18285) 2025-03-25 04:04:28 +00:00
bevy_animation Fix animation transitions affecting other entities (#18572) 2025-03-27 21:33:25 +00:00
bevy_anti_aliasing Remove Image::from_buffer name argument (only present in debug "dds" builds) (#18538) 2025-03-25 19:25:01 +00:00
bevy_app Add sleep based on spin to bevy_platform_support (#18633) 2025-03-31 23:21:49 +00:00
bevy_asset Only send unused event when final handle is dropped. (#18641) 2025-03-31 18:05:59 +00:00
bevy_audio bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
bevy_color bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
bevy_core_pipeline reexport entity set collections in entity module (#18413) 2025-03-30 03:51:14 +00:00
bevy_derive Link iOS example with rustc, and avoid C trampoline (#14780) 2025-03-17 21:14:07 +00:00
bevy_dev_tools Generic system config (#17962) 2025-03-12 00:12:30 +00:00
bevy_diagnostic Fix LogDiagnosticsPlugin log target typo (#18534) 2025-03-29 17:07:21 +00:00
bevy_dylib Switch from OnceCell to LazyLock in bevy_tasks (#18506) 2025-03-24 07:43:22 +00:00
bevy_ecs bevy_ecs/system/commands/ folder docs pass (#18639) 2025-03-31 19:26:58 +00:00
bevy_encase_derive Internalize BevyManifest logic. Switch to RwLock (#18263) 2025-03-12 00:46:01 +00:00
bevy_gilrs reexport entity set collections in entity module (#18413) 2025-03-30 03:51:14 +00:00
bevy_gizmos Rename EntityBorrow/TrustedEntityBorrow to ContainsEntity/EntityEquivalent (#18470) 2025-03-30 06:04:26 +00:00
bevy_gltf reexport entity set collections in entity module (#18413) 2025-03-30 03:51:14 +00:00
bevy_image bevy_image: derive TypePath when Reflect is not available (#18501) 2025-03-30 02:50:24 +00:00
bevy_input bevy_reflect: Add clone registrations project-wide (#18307) 2025-03-17 18:32:35 +00:00
bevy_input_focus reexport entity set collections in entity module (#18413) 2025-03-30 03:51:14 +00:00
bevy_internal Upgrade to Glam 0.29.3 and Simplify Feature Gating (#18638) 2025-03-31 18:54:46 +00:00
bevy_log Add print_stdout and print_stderr lints (#17446) (#18233) 2025-03-11 19:35:48 +00:00
bevy_macro_utils Switch to ImDocument in BevyManifest (#18272) 2025-03-12 20:15:39 +00:00
bevy_math Upgrade to Glam 0.29.3 and Simplify Feature Gating (#18638) 2025-03-31 18:54:46 +00:00
bevy_mesh Reduce dependencies on bevy_render by preferring bevy_mesh imports (#18437) 2025-03-25 04:14:42 +00:00
bevy_mikktspace Upgrade to Glam 0.29.3 and Simplify Feature Gating (#18638) 2025-03-31 18:54:46 +00:00
bevy_pbr Make bindings behind pbr_specular_textures flag consistent with other gated fields (#18645) 2025-03-31 18:49:12 +00:00
bevy_picking Return triangle index instead of vertex index (Fixes #18081) (#18647) 2025-03-31 18:50:15 +00:00
bevy_platform_support Add sleep based on spin to bevy_platform_support (#18633) 2025-03-31 23:21:49 +00:00
bevy_ptr moved Debug from derive to impl_ptr in bevy_ptr (#18042) 2025-02-28 02:54:46 +00:00
bevy_reflect Upgrade to Glam 0.29.3 and Simplify Feature Gating (#18638) 2025-03-31 18:54:46 +00:00
bevy_remote fix error and lints when building for wasm32 (#18500) 2025-03-23 22:06:28 +00:00
bevy_render Fix no indirect drawing (#18628) 2025-03-31 19:20:57 +00:00
bevy_scene reexport entity set collections in entity module (#18413) 2025-03-30 03:51:14 +00:00
bevy_sprite Parallelize bevy 0.16-rc bottlenecks (#18632) 2025-03-31 18:32:45 +00:00
bevy_state Fix misleading documentation of Main schedule (#18579) 2025-03-28 01:12:19 +00:00
bevy_tasks Switch from OnceCell to LazyLock in bevy_tasks (#18506) 2025-03-24 07:43:22 +00:00
bevy_text reexport entity set collections in entity module (#18413) 2025-03-30 03:51:14 +00:00
bevy_time Fix clippy::unnecessary-literal-unwrap in bevy_time (#18485) 2025-03-22 13:27:37 +00:00
bevy_transform Transform Propagation Optimization: Static Subtree Marking (#18589) 2025-03-30 02:43:39 +00:00
bevy_ui Rename EntityBorrow/TrustedEntityBorrow to ContainsEntity/EntityEquivalent (#18470) 2025-03-30 06:04:26 +00:00
bevy_utils Address clippy::let_and_return in bevy_utils (#18480) 2025-03-22 11:44:49 +00:00
bevy_window Rename EntityBorrow/TrustedEntityBorrow to ContainsEntity/EntityEquivalent (#18470) 2025-03-30 06:04:26 +00:00
bevy_winit 0.16 Regression fix: re-expose the display handle via a wrapper resource (#18644) 2025-03-31 18:47:08 +00:00