Skip to content

bulk does not specify what customizations need to do with exceptions thrown from invocations of f #276

Open
@lewissbaker

Description

@lewissbaker

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:

  1. do not execute f concurrently if f is potentially throwing
  2. require that f is noexcept
  3. pick an arbitrary exception thrown by one of the invocations of f
  4. pick the first exception thrown by an invocation of f - e.g. decided by some atomic-rmw operation.
  5. reduce the exceptions into a single error value (perhaps by some user-provided reduction operation)
  6. terminate on error (this would be inconsistent with the well-defined behaviour of the default sequential implementation)
  7. 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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Paper existsPaper exists, either WIP or pending-wg21bugSomething isn't workingdesigndiscussionWe need to talk about this; there's nothing actionable here yetpending-wg21A paper or an LWG issue exitsprocessedprocessed in a meeting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions