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

Update documentation for the ConditionVariable API #8511

Merged
merged 5 commits into from Oct 27, 2018
Merged

Update documentation for the ConditionVariable API #8511

merged 5 commits into from Oct 27, 2018

Conversation

ghost
Copy link

@ghost ghost commented Oct 23, 2018

Description

  • Hide protected member structures from doxygen.
  • Add some more details/comments to the example.
  • Add some defined/undefined behaviours.
  • Add some additional details to function documentation

Pull request type

[ ] Fix
[ ] Refactor
[ ] Target update
[ ] Functionality change
[X] Docs update
[ ] Test update
[ ] Breaking change

- Hide protected member structures from doxygen.
- Add some more details/comments to the example.
- Add some defined/undefined behaviours.
- Add some additional details to function documentation
Copy edit file, including existing text.
@cmonr
Copy link
Contributor

cmonr commented Oct 26, 2018

Note: This PR is now a part of a rollup PR (#8552).

No further work is needed here, as once that PR is merged, this PR will also be closed and marked as merged.

@@ -90,7 +90,7 @@ struct Waiter;
* Mutex mutex;
* ConditionVariable cv(mutex);
*
* // These variables are protected by locking mutex
* // These variables are protected by locking mutex.
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess that should be locking the mutex

rtos/ConditionVariable.h Show resolved Hide resolved
*
* // Wait for a condition to change
* cond.wait();
* while (done == false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Good point on making this a while loop. do is pretty dangerous with a condition variable.

But == false or == true is bad style

Either done isn't a boolean, in which case it's actively dangerous, or it is a boolean, in which case it's just obfuscation.

if (done) or while (!done) on a boolean reads more like natural language.

rtos/ConditionVariable.h Outdated Show resolved Hide resolved
rtos/ConditionVariable.h Show resolved Hide resolved
* - The order which in which waiting threads acquire the condition variable's
* - Calling wait if the mutex is not locked by the current thread is undefined
* behavior.
* - The order in which waiting threads acquire the condition variable's
* mutex after ConditionVariable::notify_all is called is undefined.
Copy link
Contributor

Choose a reason for hiding this comment

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

unspecified

* called and there are one or more waiters and one or more threads attempting
* to acquire the condition variable's mutex the order in which the mutex is
* called and there are one or more waiters, and one or more threads
* attempting to acquire the condition variable's mutex the order in which the mutex is
* acquired is undefined.
Copy link
Contributor

Choose a reason for hiding this comment

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

unspecified

Also spurious notifications below are unspecified, but don't seem to be able to put a comment there.

@0xc0170
Copy link
Contributor

0xc0170 commented Oct 26, 2018

@melwee01 can you respond to the latest @kjbracey-arm comments in the rollup PR (it failed just now so will need to restart CI, will wait for the update before I restart, investigating why it compiled some code that should not).

@cmonr cmonr merged commit 98e6d53 into ARMmbed:master Oct 27, 2018
@ghost ghost deleted the docs-condition-variable-refactor branch December 5, 2018 16:47
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