-
Notifications
You must be signed in to change notification settings - Fork 12
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
feat(threads): add mutex with priority inheritance #398
base: main
Are you sure you want to change the base?
Conversation
I've rebased now, and moved the |
No objections. How hard is it to chop that into another PR that we can merge right away? |
Not hard at all 🙂 #452. |
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.
I'll leave @kaspar030 review the rest of the implementation regarding priority inheritance; I have a couple of important questions regarding safety that I left as inline comments.
On another note, when should we use that new mutex? Should we replace our uses of embassy_sync::mutex::Mutex
with it?
Tldr:
The |
e55aa70
to
9c0776e
Compare
This demonstrates how multiple threads can wait for the same mutex, get unblocked by priority, and the owning thread inherits the priority of the highest waiting thread.
Address review comments.
Apply suggestions from code review Co-authored-by: ROMemories <[email protected]>
Co-authored-by: ROMemories <[email protected]>
Description
Add a mutex implementation analogous to the existing
Lock
, with additional priority inheritance.Unfortunately I don't think we can directly reuse
Lock
, because we need access to the innerThreadList
.The PR also moves all synchronization primitives into a new
sync
submodule. Any objections?Issues/PRs references
Issue: #321.
Depends on
ThreadList
by priority #381sync
submodule #452Open Questions
Change checklist