https://github.com/tzcnt/toomanycooks
C++20 thread pool / tasking library / coroutine runtime with no compromises. Excellent performance, powerful features, and simple syntax.
https://github.com/tzcnt/toomanycooks
concurrency coroutines cpp cpp20 lock-free multi-threading multithreading parallel task-graph tasking threadpool wait-free work-stealing
Last synced: 23 days ago
JSON representation
C++20 thread pool / tasking library / coroutine runtime with no compromises. Excellent performance, powerful features, and simple syntax.
- Host: GitHub
- URL: https://github.com/tzcnt/toomanycooks
- Owner: tzcnt
- License: bsl-1.0
- Created: 2023-09-02T02:05:24.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-10-05T03:33:11.000Z (27 days ago)
- Last Synced: 2025-10-05T04:28:40.174Z (27 days ago)
- Topics: concurrency, coroutines, cpp, cpp20, lock-free, multi-threading, multithreading, parallel, task-graph, tasking, threadpool, wait-free, work-stealing
- Language: C++
- Homepage:
- Size: 705 KB
- Stars: 43
- Watchers: 3
- Forks: 1
- Open Issues: 20
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
   
   [](https://codecov.io/gh/tzcnt/TooManyCooks)
## TooManyCooks
TooManyCooks is a runtime and concurrency library for C++20 coroutines. Its goals:
- be the fastest general-purpose coroutine library available ([see the benchmarks](https://github.com/tzcnt/runtime-benchmarks))
- absolutely no-fuss API
- extensive feature set
- simple and clear path to migrate legacy applications
- simple and clear path to integrate with 3rd-party executors/event loops
It provides:
- a blazing fast lock-free work-stealing thread pool (`ex_cpu`) that supports both coroutines and regular functors
- automatic, hardware-optimized thread configuration via [hwloc](https://www.open-mpi.org/projects/hwloc/)
- network I/O, file I/O, and timers support by integration with Asio (via [tmc-asio](https://github.com/tzcnt/tmc-asio))
- a global executor instance so you can submit work from anywhere
- support for multiple task priority levels
- a suite of utility functions for fluently interacting with tasks, awaitables, and executors
- traits-based extensibility for 3rd party awaitables and executors
### Read the [Documentation](https://fleetcode.com/oss/tmc/docs), try out the [Examples](https://github.com/tzcnt/tmc-examples), and run the [Tests](https://github.com/tzcnt/tmc-examples/tree/main/tests).
### Building
TooManyCooks is a header-only library. You can either include the specific headers that you need in each file, or `#include "tmc/all_headers.hpp"`, which contains all of the other headers.
In exactly one file, you must `#define TMC_IMPL` before including the headers. This will generate the function definitions for the library into that file. The simplest way to accomplish this is to put it in your `main.cpp`. Creating a [standalone compilation file](https://github.com/tzcnt/tmc-examples/blob/main/tests/standalone_compilation.cpp) is also trivial.
### Quick Start
```cpp
#define TMC_IMPL
#include "tmc/all_headers.hpp"
int main() {
return tmc::async_main(()[] -> tmc::task {
// Hello, async world!
co_return 0;
}());
}
```
### Configuration
TooManyCooks will work out of the box as a header-only library without any configuration.
However, some performance tuning options are available. See the documentation section [Build-Time Options](https://fleetcode.com/oss/tmc/docs/v0.1.0/build_flags.html) for more info.
### Release Strategy
Stable / LTS releases offer a stable API and continue to receive bugfixes for an extended period of time. The latest LTS release is [v1.0.0](https://github.com/tzcnt/TooManyCooks/releases/tag/v1.0.0).
Unstable releases get the latest and greatest performance and feature enhancements. The next unstable release will be v1.1.0.
### Roadmap
See the [issues tagged "enhancement"](https://github.com/tzcnt/TooManyCooks/issues?q=is%3Aissue%20state%3Aopen%20label%3Aenhancement) for future planned work. Please leave a :thumbsup: 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.
### Supported Compilers
Linux:
- Clang 17 or newer
- GCC 14 or newer
Windows:
- Clang 17 or newer (via clang-cl.exe)
- MSVC Build Tools v145 (Visual Studio 2026 Insiders) or newer due to [this bug](https://developercommunity.visualstudio.com/t/Incorrect-code-generation-for-symmetric/1659260?scope=follow&viewtype=all) which exists in prior versions
MacOS:
- Apple Clang based on Clang 17 or newer with -fexperimental-library
### Supported Hardware
- x86 (32- or 64-bit)
- AArch64
TooManyCooks has been tested on the following physical devices:
- Intel i7 4770k
- AMD Ryzen 5950X
- AMD EPYC 7742
- Apple M2
- Rockchip RK3588S (in a Khadas Edge2)