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

Fix future reduction with non copyable types #378

Closed
wants to merge 3 commits into from

Conversation

Grumpfy
Copy link

@Grumpfy Grumpfy commented Apr 22, 2021

Stumbled on an issue with future reduction and non copyable type.
I additionally removed the const ref qualified version of get_try from future of non copyable type interface because this method is dangerous and can easily be misused.

Copy link
Member

@sean-parent sean-parent left a comment

Choose a reason for hiding this comment

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

We need to figure out how to remove the static inline and decide how we want to handle the breaking change for async() but otherwise this looks very good!

return std::forward<R>(r);
}

static inline auto reduce(future<future<void>>&& r) -> future<void>;
Copy link
Member

Choose a reason for hiding this comment

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

I don't think static does anything useful here.

Copy link
Author

Choose a reason for hiding this comment

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

Agree, I will propose a fix in the next patch set.

@@ -1705,8 +1685,8 @@ auto when_any(E executor, F&& f, std::pair<I, I> range) {
/**************************************************************************************************/

template <typename E, typename F, typename... Args>
auto async(E executor, F&& f, Args&&... args)
-> future<detail::result_t<std::decay_t<F>, std::decay_t<Args>...>> {
auto async(E executor, F&& f, Args&&... args) -> future<
Copy link
Member

Choose a reason for hiding this comment

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

Let's discuss this as a breaking change on the (public) stlab slack - (let me know if you need an invite). Personally, I think I'm fine with it as I doubt there are any (or many) cases this would break and likely the break is minor but we might consider alternate names or using namespace versioning.

Copy link
Author

Choose a reason for hiding this comment

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

Yes, this need to be discussed. I think need an invite, I can't sign in into stlab.slack.com.

@@ -1739,6 +1719,10 @@ struct reduction_helper<future<void>> {
future<void> value;
};

static inline auto reduce(future<future<void>>&& r) -> future<void> {
Copy link
Member

Choose a reason for hiding this comment

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

Remove static and move this definition above - if this is circular we can use a tagged dispatch in a common - reduce to resolve or another technique.

Copy link
Author

Choose a reason for hiding this comment

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

Agree, I will propose a fix in the next patch set.

Change-Id: I9b38a352dc6c3a6b9484c719c64619b64c2b9c3c
@camio
Copy link
Contributor

camio commented Jul 11, 2022

@sean-parent intends to pull this PR and integrate it with other items he has been fixing. He fixed issues related to future reduction with non-copyable types so this may actually be fixed already.

@camio
Copy link
Contributor

camio commented Aug 10, 2022

Closing this pull request and created issue #486 to continue this work. Further contributions to fix #486 are more than welcome. @Grumpfy , feel free to reopen this PR if you'd like to work some more on it.

@camio camio closed this Aug 10, 2022
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