Conversation
) Now we use UnsafeCell, and we wrap all the state into a single static variable. ) Moved all the static variables to the top and put the implementation below. Tested with the rust-exercises code for the nRF52-DK.
Deploying knurling-defmt-book with
|
| Latest commit: |
63bdd03
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://5e3e0fe2.knurling-defmt-book.pages.dev |
| Branch Preview URL: | https://rtt-updates.knurling-defmt-book.pages.dev |
Contributor
Author
|
The semver-check fail is only for defmt-parser, which should probably just be published. |
Veykril
reviewed
Mar 27, 2025
| TAKEN.store(false, Ordering::Relaxed); | ||
| /// Flush the encoder | ||
| unsafe fn flush(&self) { | ||
| if !self.taken.load(Ordering::Relaxed) { |
Member
There was a problem hiding this comment.
I don't think relaxed is correct here? Nothing here enforces an ordering relationship for this load if I see that right. Given that user code can end up calling into here, correct? (similar for the other relaxed ops)
Member
There was a problem hiding this comment.
Ah wait nevermind, that's the unsafe part, we expect the lock to be acquired here I suppose
Contributor
Author
There was a problem hiding this comment.
A correct user of this API will call {acquire, write*, flush?, release}, so this check will never fail in normal operation. The acquire and release calls use critical-section, which contains the appropriate fences.
Veykril
approved these changes
Mar 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tested with the rust-exercises code for the nRF52-DK.