Skip to content

Conversation

@Yancey0623
Copy link
Contributor

Fixed #6999

void Wait() {
if (cnt_ == 0) return;
std::unique_lock<std::mutex> lock(done_m);
done_cv.wait(lock, [=] { return done_ == true; });
Copy link
Contributor

Choose a reason for hiding this comment

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

Just wait for cnt_ == 0 condition, then done_ is not needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

*/
void DecreaseCount() {
cnt_.fetch_sub(1);
if (cnt_ != 0) return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Use if (cnt_-- !=0) is simpler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, simpler is great, and I think if (cnt_-- != 1) is correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@Yancey0623
Copy link
Contributor Author

Yancey0623 commented Mar 9, 2018

No need this feature, close this PR.

@Yancey0623 Yancey0623 closed this Mar 9, 2018
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.

2 participants