Description
The current wording of bulk()
in P2300R10 has a default implementation that invokes set_error(rcvr, current_exception())
if any of the invocations of f
exit with an exception.
However, this strategy only works for sequential execution implementation strategies.
We need to specify what the semantics should be if f
exits with an exception during implementations of bulk
that execute f
concurrently.
Several options come to mind:
- do not execute
f
concurrently iff
is potentially throwing - require that
f
isnoexcept
- pick an arbitrary exception thrown by one of the invocations of
f
- pick the first exception thrown by an invocation of
f
- e.g. decided by some atomic-rmw operation. - reduce the exceptions into a single error value (perhaps by some user-provided reduction operation)
- terminate on error (this would be inconsistent with the well-defined behaviour of the default sequential implementation)
- encapsulate thrown exceptions into an exception_list but only guarantee that one exception exists in it - implementations may gather multiple of the exceptions
Also, what should the behaviour be for subsequent invocations of f
?
Should we try to cancel subsequent invocations of f
after an invocation of f
has exited with an exception?
Or should it still try to call all subsequent invocations of f
(this might be a reasonable strategy if we are reducing the errors)?
What if a stop-request is issued after the f
operation exits with an exception but before the executions on other threads can stop executing?
Should the operation as a whole complete with set_error
or should it complete with set_stopped
?