Overview of concurrencpp concepts
masterconcurrencpp is a C++ concurrency library built around three core concepts:
- Tasks: Asynchronous operations representing computational steps. They can be implemented using regular callables (lambdas, functors) or C++20 coroutines. Tasks can be suspended and resumed without blocking underlying OS threads.
- Executors: Worker objects that define where and how tasks are executed (e.g., thread pools). They decouple task scheduling from application logic.
- Result Objects: Asynchronous pipes used for communication between tasks. They allow tasks to pass results or exceptions to one another in a non-blocking manner.
The library follows the RAII pattern: a concurrencpp::runtime instance must be created (typically at the start of main) to manage the lifecycle of executors and tasks.