-
Notifications
You must be signed in to change notification settings - Fork 172
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
Add async-object #1339
base: main
Are you sure you want to change the base?
Add async-object #1339
Conversation
Looks like Tim Song reported this as a spurious warning: |
/ok to test |
/ok to test |
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 finished my review yet, but here are a few comments.
auto async_destruct(storage& stg) noexcept { | ||
auto make_destruct = [&] () noexcept -> exec::variant_sender<__destruction, __ref_storage> { | ||
if (stg.__fyn_.has_value()) { | ||
return stdexec::__apply( | ||
[&](typename stdexec::__t<_FynId>&&... __fyn) noexcept { | ||
return stdexec::__apply( | ||
[&](typename stdexec::__t<_FynId>::storage&... __stgn) noexcept { | ||
return stdexec::__apply( | ||
[&](auto&&... __d) noexcept { | ||
return stdexec::when_all( | ||
stdexec::just(std::ref(stg)), | ||
__d...); | ||
}, exec::__tuple_reverse(std::make_tuple(exec::async_destruct(__fyn, __stgn)...))); | ||
}, stg.__stgn_); | ||
}, std::move(stg.__fyn_.value())); | ||
} else { | ||
return stdexec::just(std::ref(stg)); | ||
} | ||
}; | ||
auto od = stdexec::then(make_destruct(), [](storage& stg) noexcept { | ||
stg.o.reset(); | ||
stg.__fyn_.reset(); | ||
}); | ||
return od; | ||
} |
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.
hooo boy i can see why this takes a long time to compile.
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.
Yeah, that expression cannot be reduced using a function-ptr.
However, switching to member functions did make the compilation time much better.
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.
You're using stdexec::__apply
, which means you're using std::tuple
. You might be able to improve compile times a little bit by using stdexec::__tup::__tuple
.
/ok to test |
/ok to test |
/ok to test |
This adds async-object as proposed in p2849r0.
There are a few issues with this PR
The worst issue is that
test_stop_object2.cpp
takes 4m to compile. I had to make three cpp files with one test each to get that. When one cpp had all three test cases the compiler never completed. I did add-ftime-trace
and loaded the 97mb json produced fortest_stop_object2.cpp
. It might be thestd::visit
/std::variant
/std::tuple
usage that is exploding compile times, but I do not have a solution yet.The other issue is that the build has warnings:
I am pretty sure that these are spurious since the
__decl_receiver
type is only used to test for nothrow connect and that is why it does not implement the functions.