beman.execution

beman.execution: Building Block For Asynchronous Programs

Library StatusStandard TargetCoveragehttps://godbolt.org/z/jeMEWGYbM[Compiler Explorer Example]

beman.execution provides the basic vocabulary for asynchronous programming as well as important algorithms implemented in terms of this vocabulary.

The key entities of the vocabulary are:

  • scheduler used to control where operations are executed.

    • The key operation is schedule(scheduler) → sender.

  • sender used to represent work.

    • The key operation is connect(sender, receiver) → operation-state.

  • receiver used to receive completion notifications.

    • There are multiple operations on receivers:

      • set_value(receiver, args…​) for successful completions.

      • set_error(receiver, error) to report errors.

      • set_stopped(receiver) to report cancellation.

  • operation-state to represent a ready to run work graph .

    • The key operation is start(state).

Using these operations some fundamental algorithms are implemented, e.g.:

  • just(args…​) as the starting point of a work graph without a specified scheduler`.

  • let_value(sender, fun) to produce a sender based on `sender’s results.

  • starts_on(scheduler, sender) to start sender on scheduler.

  • continues_on(sender, scheduler) to complete with sender’s results on `scheduler.

  • when_all(sender …​) to complete when all `sender`s have completed.

  • bulk(…​) to executed execute work, potentially concurrently.

Help Welcome!

There are plenty of things which need to be done. See the contributions page for some ideas how to contribute. The resources page contains some links for general information about the sender/receivers and std::execution.

Dependencies

Build Environment

This project requires at least the following to build:

  • A C compiler that conforms to the C23 standard or greater

  • CMake 3.30 or later

You can disable building tests by setting CMake option BEMAN_EXECUTION_BUILD_TESTS to OFF when configuring the project.

You can disable building examples by setting CMake option BEMAN_EXECUTION_BUILD_EXAMPLES to OFF when configuring the project.

Library Linux MacOS Windows

build

Linux build status

MacOS build status

Window build status

The following instructions build the library and the examples:

ln -s cmake/CMakeUserPresets.json .
cmake --workflow --list-presets
Available workflow presets:

  "debug"
  "release"
  "gcc-debug"
  "gcc-release"
  "llvm-debug"
  "llvm-release"
  "msvc-debug"
  "msvc-release"


CXX=g++-15 cmake --workflow --preset release

The implementation compiles and passes tests using clang, gcc, and MSVC++.

Supported Platforms

Compiler Version C++ Standards Standard Library

GCC

15-14

C26, C23

libstdc++

Clang

22-19

C26, C23

libc++

MSVC

latest

C++23

MSVC STL

License

beman.execution is licensed under the Apache License v2.0 with LLVM Exceptions.

Examples