Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support shared futures on no_std #2868

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

adavis628
Copy link

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.

@taiki-e
Copy link
Member

taiki-e commented Oct 2, 2024

Thanks for the PR. I would prefer not to use spinlock by default around operations that would involve allocations even if it is no_std-only.

That said, it might be fine if this is an optional feature and spinlock is used only when std is disabled and the feature is explicitly enabled.

@taiki-e taiki-e added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author A-future Area: futures::future labels Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-future Area: futures::future S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants