-
Notifications
You must be signed in to change notification settings - Fork 77
feat: Basic support for channels #2859
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
base: develop
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2859 +/- ##
===========================================
+ Coverage 81.86% 81.91% +0.04%
===========================================
Files 381 382 +1
Lines 14417 14472 +55
Branches 7935 7951 +16
===========================================
+ Hits 11803 11855 +52
Misses 1446 1446
- Partials 1168 1171 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mathbunnyru
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't read test file yet, will review a bit later
| result = std::forward<decltype(value)>(value); | ||
| }); | ||
|
|
||
| if (received) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible for some reason to have error in ec, but received True?
And why is there 2 ways to communicate the error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too sure we actually need the ec at all as we don't actually use it when we send. when we receive i imagine there should be an internal ec somewhere. I will check if we can get rid of it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm, i could not remove error_code from the channel signature. I expected that would be easy but looks like you need that error_code in the signature
|
|
||
| if (params_.approachType == ApproachType::Spawn) { | ||
| util::spawn(executor, [&receiver, &receivedValues](boost::asio::yield_context yield) mutable { | ||
| while (receivedValues.size() < kTOTAL_EXPECTED) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should check that we have exactly kTOTAL_EXPECTED values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We check it below already, is that not what you meant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, my wording is bad.
Right now you're pushing to vector only if while (receivedValues.size() < kTOTAL_EXPECTED), so it's impossible you're going to have more than kTOTAL_EXPECTED values pushed to vector
This doesn't check that receiver is not able to receive a few more values though.
Imagine, there is a bug, and we do not account for some values in queue when receiving.
I suggest after this while to write tryReceive and check it fails
This PR implements go-like channels wrapper (on top of asio experimental channels).
In the future this will be integrated into the AsyncFramework.