Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/seastar/core/future.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1994,14 +1994,14 @@ template<typename T>
template<typename Func, typename... FuncArgs>
typename futurize<T>::type futurize<T>::invoke(Func&& func, FuncArgs&&... args) noexcept {
Copy link
Member

Choose a reason for hiding this comment

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

  • Forward the function itself, not just the arguments. This allows
    an rvalue-qualified operator() to be called if present.

950b54e beat you to it, so now you get to rebase and I get to re-run CI

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah haha, weird how it was like that for 8 years or whatever then suddenly two very similar changes collide.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Rebased and commit message updated.

try {
using ret_t = decltype(std::forward<Func>(func)(std::forward<FuncArgs>(args)...));
using ret_t = std::invoke_result_t<Func, FuncArgs&&...>;
if constexpr (std::is_void_v<ret_t>) {
std::forward<Func>(func)(std::forward<FuncArgs>(args)...);
std::invoke(std::forward<Func>(func), std::forward<FuncArgs>(args)...);
return make_ready_future<>();
} else if constexpr (is_future<ret_t>::value) {
return std::forward<Func>(func)(std::forward<FuncArgs>(args)...);
return std::invoke(std::forward<Func>(func), std::forward<FuncArgs>(args)...);
} else {
return convert(std::forward<Func>(func)(std::forward<FuncArgs>(args)...));
return convert(std::invoke(std::forward<Func>(func), std::forward<FuncArgs>(args)...));
}
} catch (...) {
return current_exception_as_future();
Expand Down