You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Doesn't the steal function need to mark the peripherals taken so that take will work as intended? Otherwise, using take after steal will get the peripherals when we don't know that there is exclusive access via take.
Otherwise, using take after steal will get the peripherals when we don't know that there is exclusive access via take.
Yes, and this is the correct result. steal is already unsafe, therefore, if you call it, you cannot guarantee that other code somewhere else does not have a duplicate instance of the peripherals. It is therefore your job to make sure that this isn't a problem.
However, suppose you are writing unsafe code and you need to call cortex-m methods, while still allowing safe code to take them. There is no way to do so without using a transmute, because calling steal will impact take.
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
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.
The steal function is already unsafe, so there's no need to mark taken to make sure that someone else doesn't take it.