-
Notifications
You must be signed in to change notification settings - Fork 110
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
Add no_std
implementation based on critical-section
.
#195
Conversation
771a98b
to
3435d24
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 so, historically I've been pretty opposed to "just works" implementation on no_std, as how exactly one does locking is pretty important, and spinlocks is decidedly not a way to go, there's some discussion in #61.
The approach roughly like this could work though:
- if we use a critical section rather than spinning, that counts as proper blocking in at least some contexts
- the experience is that the user has to explicitly enable the
critical_section
feature, so they are opting into this behavior
So, yeah, I think I am generally on board with it. However, it is important that we don't actually spin here (the current implementation does spin).
Okay, so I have a different implementation which doesn't spin and simply completely blocks all threads during |
89a5da8
to
bdb7107
Compare
no_std
implementation based on critical-section
/atomic-polyfill
.no_std
implementation based on critical-section
.
ff0a4ba
to
42e9c79
Compare
@matklad, can you have another look? |
ced0703
to
124c01d
Compare
@matklad, can you have another look at this? Thanks. |
…res are enabled.
589c61e
to
7d9afdb
Compare
lgtm! bors r+ |
Build succeeded: |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [once_cell](https://github.com/matklad/once_cell) | dependencies | minor | `1.15.0` -> `1.16.0` | --- ### Release Notes <details> <summary>matklad/once_cell</summary> ### [`v1.16.0`](https://github.com/matklad/once_cell/blob/HEAD/CHANGELOG.md#​1160) [Compare Source](matklad/once_cell@v1.15.0...v1.16.0) - Add `no_std` implementation based on `critical-section`, [#​195](matklad/once_cell#195). - Deprecate `atomic-polyfill` feature (use the new `critical-section` instead) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC44LjAiLCJ1cGRhdGVkSW5WZXIiOiIzNC45LjEifQ==--> Co-authored-by: cabr2-bot <[email protected]> Reviewed-on: https://codeberg.org/Calciumdibromid/CaBr2/pulls/1615 Reviewed-by: crapStone <[email protected]> Co-authored-by: Calciumdibromid Bot <[email protected]> Co-committed-by: Calciumdibromid Bot <[email protected]>
Add implementation based on
critical-section
for embedded targets.This started out using
critical_section::Mutex
, but tests were failing sincecritical_section::with
blocks all threads during initialization, so I changed it to be basically the same asimp_pl
without theparking_lot
parts, sinceatomic-polyfill
is based oncritical-section
.Depends on rust-embedded/critical-section#26.