Repository navigation
Allow potentially throwing value copies in thread pool bulk - #2468
Merged
Merged
Conversation
`bulk` on `exec::static_thread_pool` (and other pools built on `thread_pool_base`) rejected predecessors whose values are copyable but not nothrow-copyable, e.g. `std::vector<int>&`, with _PREDECESSOR_RESULTS_ARE_NOT_DECAY_COPYABLE_. [exec.bulk] only requires the decayed values to be copy constructible, and the bulk receiver already turns an exception from storing them into set_error(std::exception_ptr). Require `__decay_copyable` instead of `__nothrow_decay_copyable`, and advertise set_error(std::exception_ptr) when storing the values can throw, matching windows_thread_pool.
ericniebler
approved these changes
Nov 19, 2026
Collaborator
|
/ok to test 32cac6a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On
exec::static_thread_pool,bulkrejects a predecessor that completes withstd::vector<int>&, failing with_PREDECESSOR_RESULTS_ARE_NOT_DECAY_COPYABLE_, even when the callback isnoexcept:The same pipeline compiles with
ex::just()in place of the pool sender. exec.bulk only requires the decayed values to be copy constructible, not nothrow copy constructible.Since #2357 the check is in
_get_bulk_sender_cmplsigs_transforminthread_pool_base.hpp. It required__nothrow_decay_copyable, but_bulk_receiver::set_valuealready catches an exception from storing the values and sendsset_error(std::exception_ptr). This PR gates on__decay_copyableand addsset_error(std::exception_ptr)to the completion signatures when the copy can throw. That is the rulewindows_thread_pool.hppalready uses, and thebulk_chunkedpath already accepts throwing copies (see "thread_pool_base bulk stops after value capture fails").The new test in
test_static_thread_pool.cppchecks the vector case end to end, including the exact completion signatures, and checks that a throwing copy is reported throughset_errorwithout running the callback, for shapes 0 and 4. Its test file fails to compile without the change. With it, test.exec passes (520 cases) and test.stdexec passes (697 cases) with GCC 13.3, Release. clang-format 21 reports no changes.