bevy/crates
Zachary Harrold 04990fcd27
Move spin to bevy_platform_support out of other crates (#17470)
# Objective

- Contributes to #16877

## Solution

- Expanded `bevy_platform_support::sync` module to provide
API-compatible replacements for `std` items such as `RwLock`, `Mutex`,
and `OnceLock`.
- Removed `spin` from all crates except `bevy_platform_support`.

## Testing

- CI

---

## Notes

- The sync primitives, while verbose, entirely rely on `spin` for their
implementation requiring no `unsafe` and not changing the status-quo on
_how_ locks actually work within Bevy. This is just a refactoring to
consolidate the "hacks" and workarounds required to get a consistent
experience when either using `std::sync` or `spin`.
- I have opted to rely on `std::sync` for `std` compatible locks,
maintaining the status quo. However, now that we have these locks
factored out into the own module, it would be trivial to investigate
alternate locking backends, such as `parking_lot`.
- API for these locking types is entirely based on `std`. I have
implemented methods and types which aren't currently in use within Bevy
(e.g., `LazyLock` and `Once`) for the sake of completeness. As the
standard library is highly stable, I don't expect the Bevy and `std`
implementations to drift apart much if at all.

---------

Co-authored-by: BD103 <59022059+BD103@users.noreply.github.com>
Co-authored-by: Benjamin Brienen <benjamin.brienen@outlook.com>
2025-01-23 05:27:02 +00:00
..
bevy_a11y Add no_std Support to bevy_a11y (#17505) 2025-01-23 03:52:47 +00:00
bevy_animation Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_app Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_asset Update async-broadcast (#17500) 2025-01-23 05:24:34 +00:00
bevy_audio Relationships (non-fragmenting, one-to-many) (#17398) 2025-01-18 22:20:30 +00:00
bevy_color Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_core_pipeline Refactored ComponentHook Parameters into HookContext (#17503) 2025-01-23 02:45:24 +00:00
bevy_derive Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_dev_tools Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_diagnostic Add no_std support to bevy_diagnostic (#17507) 2025-01-23 05:20:34 +00:00
bevy_dylib Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_ecs Move spin to bevy_platform_support out of other crates (#17470) 2025-01-23 05:27:02 +00:00
bevy_encase_derive Bump Version after Release (#17176) 2025-01-06 00:04:44 +00:00
bevy_gilrs Support non-Vec data structures in relations (#17447) 2025-01-20 21:26:08 +00:00
bevy_gizmos Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_gltf Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_image Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_input Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_input_focus Refactored ComponentHook Parameters into HookContext (#17503) 2025-01-23 02:45:24 +00:00
bevy_internal Create bevy_platform_support Crate (#17250) 2025-01-20 20:45:30 +00:00
bevy_log Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_macro_utils Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_math Reworked Segment types into their cartesian forms (#17404) 2025-01-19 03:54:45 +00:00
bevy_mesh Mesh::merge to return a Result (#17475) 2025-01-23 04:05:36 +00:00
bevy_mikktspace Move #![warn(clippy::allow_attributes, clippy::allow_attributes_without_reason)] to the workspace Cargo.toml (#17374) 2025-01-15 01:14:58 +00:00
bevy_pbr Only include distance fog in the PBR shader if the view uses it. (#17495) 2025-01-23 05:24:54 +00:00
bevy_picking Parent -> ChildOf (#17427) 2025-01-20 22:13:29 +00:00
bevy_platform_support Move spin to bevy_platform_support out of other crates (#17470) 2025-01-23 05:27:02 +00:00
bevy_ptr Update safety docs for Ptr::assert_unique (#17394) 2025-01-16 03:25:19 +00:00
bevy_reflect Move spin to bevy_platform_support out of other crates (#17470) 2025-01-23 05:27:02 +00:00
bevy_remote Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_render Readback: Add support for texture depth/array layers (#17479) 2025-01-23 05:25:40 +00:00
bevy_scene Refactored ComponentHook Parameters into HookContext (#17503) 2025-01-23 02:45:24 +00:00
bevy_sprite Retain RenderMaterialInstances and RenderMeshMaterialIds from frame to frame. (#16985) 2025-01-22 03:35:46 +00:00
bevy_state Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00
bevy_tasks Move spin to bevy_platform_support out of other crates (#17470) 2025-01-23 05:27:02 +00:00
bevy_text Add warning for font sizes <= 0.0 (#17501) 2025-01-23 02:43:59 +00:00
bevy_time Fix Time (#17504) 2025-01-23 02:44:16 +00:00
bevy_transform Parent -> ChildOf (#17427) 2025-01-20 22:13:29 +00:00
bevy_ui Remove ViewVisibility from UI nodes (#17405) 2025-01-23 05:26:10 +00:00
bevy_utils Create bevy_platform_support Crate (#17250) 2025-01-20 20:45:30 +00:00
bevy_window Move spin to bevy_platform_support out of other crates (#17470) 2025-01-23 05:27:02 +00:00
bevy_winit Move Resource trait to its own file (#17469) 2025-01-21 19:47:08 +00:00