C++20 concurrency framework with no compromises. Excellent performance, powerful features, and simple syntax.
C++
283
374 commits
updated Oct 11, 2026
TooManyCooks is a runtime and concurrency library for C++20 coroutines. Its goals:
It provides:
ex_cpu)// A complete implementation of the parallel recursive fibonacci benchmark
#define TMC_IMPL
#include "tmc/all_headers.hpp"
#include <iostream>
tmc::task<int> fib(int n) {
if (n < 2) {
co_return n;
}
// The return type of a single task would be `int`.
// Here, we run 2 tasks in parallel and retrieve the results in a `std::tuple<int, int>`.
auto [x, y] = co_await tmc::spawn_tuple(fib(n - 1), fib(n - 2));
co_return x + y;
}
int main() {
// Manually construct an executor and block on a root task.
// `tmc::async_main()` could be used instead to simplify this.
tmc::cpu_executor().init();
// Synchronous (blocking) APIs return a std::future.
int result = tmc::post_waitable(tmc::cpu_executor(), fib(30)).get();
std::cout << result << std::endl;
}
TooManyCooks is a header-only library. Just add /include to your include path.
Then #include "tmc/all_headers.hpp" for the entire library, or choose specific headers that you need.
This repo offers a CMakeLists.txt with an INTERFACE target that adds this include directory, which can be consumed like so:
add_subdirectory(${TooManyCooks_DIR} CONFIG REQUIRED)
target_link_libraries(main PRIVATE TooManyCooks::TooManyCooks)
TMC offers some compile-time configuration options via preprocessor definitions (documented here). The CMake target exposes CMake options that map directly to these preprocessor definitions and ensures they are propagated to all library consumers.
The use of CMake is not required; the library can also be configured by setting the preprocessor definitions manually. If done this way, you must set these definitions identically across all files that consume any TMC headers.
For a minimal consumer project template, see tmc-hello-world.
include/tmc/asio/ folder.TMC_USE_BOOST_ASIO=ON to use Boost.Asio.conanfile.py is provided in this repo which exposes all of the configuration options and resolves the optional dependencies.
Export this repository's Conan recipe into your local Conan package cache from the repository root:
conan export .
Then, from a consumer project's conanfile.py, add the project and configure any desired options:
requires = "toomanycooks/1.7.0"
default_options = {
"toomanycooks/*:trivial_task": True,
"toomanycooks/*:nodiscard_await": True,
}
TooManyCooks can be consumed with vcpkg manifest mode from this repository's overlay port.
In the consumer repository, add a vcpkg-configuration.json that points to the overlay port:
{
"overlay-ports": [
"submodules/TooManyCooks/ports"
]
}
Then add a vcpkg.json dependency with any desired features, e.g. TMC_TRIVIAL_TASK and TMC_NODISCARD_AWAIT:
{
"dependencies": [
{
"name": "toomanycooks",
"features": [
"trivial-task",
"nodiscard-await"
]
}
]
}
See the vcpkg usage file for more info.
See the issues tagged "enhancement" for future planned work. Please leave a 👍 on any issues that are important to you. I will use this as a way to gauge community interest on what should be developed next.
GCC and Clang are supported, but Clang is the recommended compiler, as it has the best coroutine codegen and the most functional HALO implementation.
Linux (kernel 5.16 or newer for futex_waitv):
Windows:
MSVC is not supported due to this compiler bug which causes a critical miscompilation. MSVC builds may work in Debug mode but crash on Release builds.
MacOS:
-fexperimental-libraryTooManyCooks is regularly tested on the following physical devices:
458 followers · starred Apr 2026
63 followers · starred Feb 2026
41 followers · starred Feb 2026
193 followers · starred Jun 2026
C++20 concurrency framework with no compromises. Excellent performance, powerful features, and simple syntax.
C++
283
374 commits
updated Oct 11, 2026
TooManyCooks is a runtime and concurrency library for C++20 coroutines. Its goals:
It provides:
ex_cpu)// A complete implementation of the parallel recursive fibonacci benchmark
#define TMC_IMPL
#include "tmc/all_headers.hpp"
#include <iostream>
tmc::task<int> fib(int n) {
if (n < 2) {
co_return n;
}
// The return type of a single task would be `int`.
// Here, we run 2 tasks in parallel and retrieve the results in a `std::tuple<int, int>`.
auto [x, y] = co_await tmc::spawn_tuple(fib(n - 1), fib(n - 2));
co_return x + y;
}
int main() {
// Manually construct an executor and block on a root task.
// `tmc::async_main()` could be used instead to simplify this.
tmc::cpu_executor().init();
// Synchronous (blocking) APIs return a std::future.
int result = tmc::post_waitable(tmc::cpu_executor(), fib(30)).get();
std::cout << result << std::endl;
}
TooManyCooks is a header-only library. Just add /include to your include path.
Then #include "tmc/all_headers.hpp" for the entire library, or choose specific headers that you need.
This repo offers a CMakeLists.txt with an INTERFACE target that adds this include directory, which can be consumed like so:
add_subdirectory(${TooManyCooks_DIR} CONFIG REQUIRED)
target_link_libraries(main PRIVATE TooManyCooks::TooManyCooks)
TMC offers some compile-time configuration options via preprocessor definitions (documented here). The CMake target exposes CMake options that map directly to these preprocessor definitions and ensures they are propagated to all library consumers.
The use of CMake is not required; the library can also be configured by setting the preprocessor definitions manually. If done this way, you must set these definitions identically across all files that consume any TMC headers.
For a minimal consumer project template, see tmc-hello-world.
include/tmc/asio/ folder.TMC_USE_BOOST_ASIO=ON to use Boost.Asio.conanfile.py is provided in this repo which exposes all of the configuration options and resolves the optional dependencies.
Export this repository's Conan recipe into your local Conan package cache from the repository root:
conan export .
Then, from a consumer project's conanfile.py, add the project and configure any desired options:
requires = "toomanycooks/1.7.0"
default_options = {
"toomanycooks/*:trivial_task": True,
"toomanycooks/*:nodiscard_await": True,
}
TooManyCooks can be consumed with vcpkg manifest mode from this repository's overlay port.
In the consumer repository, add a vcpkg-configuration.json that points to the overlay port:
{
"overlay-ports": [
"submodules/TooManyCooks/ports"
]
}
Then add a vcpkg.json dependency with any desired features, e.g. TMC_TRIVIAL_TASK and TMC_NODISCARD_AWAIT:
{
"dependencies": [
{
"name": "toomanycooks",
"features": [
"trivial-task",
"nodiscard-await"
]
}
]
}
See the vcpkg usage file for more info.
See the issues tagged "enhancement" for future planned work. Please leave a 👍 on any issues that are important to you. I will use this as a way to gauge community interest on what should be developed next.
GCC and Clang are supported, but Clang is the recommended compiler, as it has the best coroutine codegen and the most functional HALO implementation.
Linux (kernel 5.16 or newer for futex_waitv):
Windows:
MSVC is not supported due to this compiler bug which causes a critical miscompilation. MSVC builds may work in Debug mode but crash on Release builds.
MacOS:
-fexperimental-libraryTooManyCooks is regularly tested on the following physical devices:
458 followers · starred Apr 2026
63 followers · starred Feb 2026
41 followers · starred Feb 2026
193 followers · starred Jun 2026