-
Notifications
You must be signed in to change notification settings - Fork 178
Mutex doc #769
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
Mutex doc #769
Conversation
I dont know why it combined my CAN changes (for which I already filed PR) with this PR. Looking into it |
Fixed now |
Thanks for the PR 👍 |
docs/api/rtos/Mutex.md
Outdated
|
||
A Mutex is used to synchronize the execution of threads, for example to protect the access to a shared resource. | ||
|
||
<span class="notes"> **Note:** The `Mutex` methods cannot be called from interrupt service routines (ISR). In the current version of Mbed OS, if you attempt to use a mutex from within an ISR, nothing happens; attempts to lock a mutex succeed immediately, regardless of whether the lock is actually free. In other words, if you acquire a mutex lock in an ISR, you can break the thread safety mechanisms and introduce race-conditions into an otherwise safe piece of code. Future versions of Mbed OS will provide warnings and ultimately prevent this from happening. </span> | ||
<span class="notes"> **Note:** The `Mutex` methods cannot be called from interrupt service routines (ISR). In the current version of Mbed OS, if you attempt to use a mutex from within an ISR, you see an error like this: </span> |
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.
Can we change
if you attempt to use a mutex from within an ISR, you see an error like this:
to
if you attempt to use a mutex from within an ISR, it will treat it as fatal system error and you see an error like this
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.
Also we can add if synchronization is required in ISR, consider using semaphores
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.
Both good points. @AnotherButler can we hold off the merge of this PR while I work on these changes.?
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.
"if you attempt to use a mutex from within an ISR, the ISR treats the mutex as a fatal system error, and you see an error like this:"?
Added few more doc modifications. Seems good now. |
Standardize class hierarchy diagram structure.
Remove note formatting for better UX.
Update content as in PR #769
Correct mutex documentation according to latest mbed os version