Skip to content

Conversation

@AlixANNERAUD
Copy link
Contributor

@AlixANNERAUD AlixANNERAUD commented Dec 13, 2025

This pull request refactors the usage of Arc across the codebase to consistently import it from the new synchronization module, rather than directly from alloc::sync. It also introduces a conditional implementation of Arc that uses either the standard library or a custom version depending on platform atomic support. Additionally, it makes minor dependency and module organization improvements.

Refactoring and Consistency Improvements:

  • Replaced direct imports of alloc::sync::Arc with synchronization::Arc in multiple files, ensuring a unified import path for Arc and improving code maintainability (drivers/native/src/devices/window_screen/window.rs, drivers/wasm/src/devices/graphics/mouse.rs, modules/task/src/environment_variable.rs, modules/task/src/join_handle.rs). [1] [2] [3] [4]

Platform Abstraction and Conditional Compilation:

  • Introduced a conditional export in modules/synchronization/src/arc/mod.rs to use the standard library's Arc and Weak when atomic operations are available, and a custom arc_lock implementation otherwise.
  • Added a new arc module to modules/synchronization, and re-exported its contents through the crate root for easier access.

Dependency and Build Configuration:

  • Updated modules/synchronization/Cargo.toml to add critical-section as a dev-dependency for desktop platforms, and ensured embassy-sync is only included for the appropriate targets.

@AlixANNERAUD AlixANNERAUD linked an issue Dec 13, 2025 that may be closed by this pull request
@AlixANNERAUD AlixANNERAUD changed the title 148 implement universal arc for non atomic platform Provide universal Arc implementation for non-atomic platforms Dec 13, 2025
@AlixANNERAUD AlixANNERAUD merged commit 8e3b343 into main Dec 13, 2025
1 check failed
@AlixANNERAUD AlixANNERAUD deleted the 148-implement-universal-arc-for-non-atomic-platform branch December 13, 2025 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide universal Arc implementation for non-atomic platforms

2 participants