rust-lang / futures-rs

Zero-cost asynchronous programming in Rust
https://rust-lang.github.io/futures-rs/
Apache License 2.0
5.29k stars 607 forks source link

Support shared futures on no_std #2868

Open adavis628 opened 5 days ago

adavis628 commented 5 days ago

Currently, Shared futures are only available when the std feature is enabled because they use std::sync::Mutex internally. This PR changes this so that Shared futures will fall back to using a spinlock when std is not enabled.

Alternatively, Shared could be changed to be generic over a mutex trait (e.g. lock_api::RawMutex, though it isn't implemented for std::sync::Mutex) to allow arbitrary user implementations.