Skip to content

improve mutex doc #8391

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 13, 2018
Merged

improve mutex doc #8391

merged 4 commits into from
Oct 13, 2018

Conversation

aashishc1988
Copy link
Contributor

Description

Improve documentation for mutex

[ ] Fix
[x ] Refactor
[ ] Target update
[ ] Functionality change
[ ] Breaking change

@aashishc1988
Copy link
Contributor Author

@AnotherButler

rtos/Mutex.h Outdated
@@ -82,7 +82,7 @@ class Mutex : private mbed::NonCopyable<Mutex> {
Wait until a Mutex becomes available.

@return status code that indicates the execution status of the function:
@a osOK the mutex has been obtained.
@a Status code like osOK indicates that the mutex has been obtained.
Copy link
Contributor

Choose a reason for hiding this comment

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

"Like" means similar to but not including. "Such as" means similar to and including. So if osOK is a status code that indicates that the mutex has been obtained, please change "like" to "such as". If osOK is similar to status code that indicates that the mutex has been obtained but isn't that, please leave as is.

rtos/Mutex.h Outdated
@@ -144,7 +144,7 @@ class Mutex : private mbed::NonCopyable<Mutex> {
Unlock the mutex that has previously been locked by the same thread

@return status code that indicates the execution status of the function:
@a osOK the mutex has been released.
@a Status code like osOK indicates that the mutex has been released.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please see earlier comment.

@aashishc1988
Copy link
Contributor Author

Modified

rtos/Mutex.h Outdated
@@ -82,7 +82,7 @@ class Mutex : private mbed::NonCopyable<Mutex> {
Wait until a Mutex becomes available.

@return status code that indicates the execution status of the function:
@a osOK the mutex has been obtained.
@a Status code such as osOK indicates that the mutex has been obtained.
Copy link
Contributor

Choose a reason for hiding this comment

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

No, the only thing this can return is osOK. See the note below. Same for the other function

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

addressed

aashishc1988 and others added 2 commits October 12, 2018 10:51
Make minor copy edits to existing text.
@cmonr cmonr merged commit bbc6e5d into ARMmbed:master Oct 13, 2018

@note You cannot use member functions of this class in ISR context. If you require Mutex functionality within
ISR handler, consider using @a Semaphore.

@note
Memory considerations: The mutex control structures will be created on current thread's stack, both for the Mbed OS
Memory considerations: The mutex control structures are created on the current thread's stack, both for the Mbed OS
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't have noticed this note apart from the edit, but it's false.

The RTOS mutex control structure is embedded in the Mutex object itself (rather than any RTOS memory pool), so the allocation is determined by where you allocate the Mutex. That could conceivably be on the stack, but not in any normal application.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry I was not in office for couple of days. We would need to file separate PR for it since this is already merged. @kjbracey-arm , would you please file a PR with the accurate description? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants