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

Replace C++ CountDownLatch with std::promise #1854

Merged
merged 3 commits into from
Feb 27, 2024

Conversation

pepone
Copy link
Member

@pepone pepone commented Feb 26, 2024

No description provided.

Comment on lines +695 to +696
call->run();
dispatchPromise.set_value();
Copy link
Member

Choose a reason for hiding this comment

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

Is this run call guaranteed to never throw?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so. This keeps the previous behavior. Maybe is more correct to catch the exception and use it to complete the promise.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Seems SessionHelper is the only place where we still use it. I will remove it.

Copy link
Member

@bernardnormier bernardnormier Feb 27, 2024

Choose a reason for hiding this comment

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

According to the Ice Manual:

The call given to the dispatcher takes no parameters, returns nothing, and never throws any exception back to the dispatcher.

We should mark it noexcept. So I wouldn't worry about the exception is throws.

Copy link
Member

Choose a reason for hiding this comment

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

And in this particular case, all the "callbacks" are SessionHelper code, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

The callbacks call to the user provided SessionCallback.

@pepone pepone merged commit d8a0f94 into zeroc-ice:main Feb 27, 2024
4 checks passed
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