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

Implement a "SpinMutex" #27

Merged
merged 4 commits into from
Nov 20, 2024
Merged

Implement a "SpinMutex" #27

merged 4 commits into from
Nov 20, 2024

Conversation

d3zd3z
Copy link
Collaborator

@d3zd3z d3zd3z commented Oct 31, 2024

The SpinMutex uses a spinlock to protect a piece of data so that it can be shared safely (with safe Rust code) between both thread context and irq contexts.

@d3zd3z d3zd3z requested review from teburd, cfriedt and ithinuel October 31, 2024 23:32
@cfriedt
Copy link
Member

cfriedt commented Nov 1, 2024

Looks nifty

This type is used like a data item, so derive Copy/Clone for it.  This
also adds some macros to make this easier to add additional types later.

Signed-off-by: David Brown <[email protected]>
Avoid cluttering the top-level sync module with specifics.

Signed-off-by: David Brown <[email protected]>
The SpinMutex uses a spinlock to protect a piece of data so that it can
be shared safely (with safe Rust code) between different contexts.

Signed-off-by: David Brown <[email protected]>
Print the type of this item specifically as SpinMutex instead of just
Mutex, so that it if is used in debug messages, it will be helpful (and
correct).

Signed-off-by: David Brown <[email protected]>
Copy link
Collaborator

@Ablu Ablu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks fairly straight-forward!

@d3zd3z d3zd3z merged commit e7d40e3 into main Nov 20, 2024
1 check passed
@d3zd3z d3zd3z deleted the spinmutex branch November 20, 2024 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants