Skip to content

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

Merged
merged 4 commits into from
Oct 15, 2018
Merged

Mutex doc #769

merged 4 commits into from
Oct 15, 2018

Conversation

aashishc1988
Copy link
Contributor

Correct mutex documentation according to latest mbed os version

@aashishc1988
Copy link
Contributor Author

I dont know why it combined my CAN changes (for which I already filed PR) with this PR. Looking into it

@aashishc1988
Copy link
Contributor Author

Fixed now

@AnotherButler
Copy link
Contributor

Thanks for the PR 👍


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>

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

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

Copy link
Contributor Author

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.?

Copy link
Contributor

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:"?

@aashishc1988
Copy link
Contributor Author

Added few more doc modifications. Seems good now.

Amanda Butler added 2 commits October 15, 2018 16:27
Standardize class hierarchy diagram structure.
Remove note formatting for better UX.
@AnotherButler AnotherButler merged commit 0ed3b02 into ARMmbed:development Oct 15, 2018
AnotherButler pushed a commit that referenced this pull request Oct 15, 2018
Update content as in PR #769
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.

3 participants