-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
coroutine: experimental: generator: implement move and swap #2354
base: master
Are you sure you want to change the base?
Conversation
The coroutine generator move ctor, move assignment operator, and swap override were never fully implemented. This patch completes their implementation and adds unit tests to cover move and swap and also moving not-drained generator (to test moving of their buffered value(s)). Fixes scylladb#1789 Signed-off-by: Benny Halevy <[email protected]>
1d7a876
to
311c33d
Compare
@bhalevy hi Benny, thank you for addressing this issue. but i think the more fundamental problems of the generator are
I believe we should address these issues before fixing the move semantics of the generator. I agree that they are the next important matters to tackle. Perhaps you could help review pull request #2218? Once it's merged, we should be in a better position to resolve issue #1789. What are your thoughts on this approach? |
I have no objection. |
@avikivity, @tchaikov: since #2218 is taking longer than expected, Cc @regevran |
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.
@scylladb/seastar-maint please consider merging. |
_promise->set_generator(this); | ||
} | ||
_values = std::move(other._values); | ||
const_cast<size_t&>(_buffer_capacity) = other._buffer_capacity; |
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:
const_cast<size_t&>(_buffer_capacity) = other._buffer_capacity; | |
const_cast<size_t&>(_buffer_capacity) = std::exchange(other._buffer_capacity, 0); |
@@ -768,6 +774,37 @@ seastar::future<> test_async_generator_drained() { | |||
BOOST_REQUIRE(!sentinel.has_value()); | |||
} | |||
|
|||
template<template<typename> class Container> |
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.
The entire new section is missing some verbal explanations about the tests, the expected results and how they are achieved.
The coroutine generator move ctor, move assignment operator, and swap override were never fully implemented.
This patch completes their implementation
and adds unit tests to cover move and swap
and also moving not-drained generator (to test
moving of their buffered value(s)).
Fixes #1789