How mtmucha/coros works
Main Components
• Library Interfaces (Headers):
▪ coros::Task<T>: The task abstraction that uses coroutines.
▪ coros::ThreadPool: The task execution environment managing worker threads.
▪ Awaiters: The objects enabling suspension/resume via co_await.
▪ Utility components (chain_tasks.h, enqueue_tasks.h, wait_tasks.h, start_tasks.h, etc.) for scheduling, chaining, and task management.
▪ Supporting data structures: e.g., concurrentqueue.h, deque.h (used for task scheduling algorithms).
• Execution and Scheduling Mechanisms:
• “Start Tasks” functionality:
▪ start_sync and start_async for launching tasks on a ThreadPool.
• “Wait Tasks” functions:
▪ wait_tasks and wait_tasks_async that suspend execution until a set of tasks is complete.
• “Enqueue Tasks” functions:
▪ enqueue_tasks used to schedule tasks without waiting.
• “Chain Tasks” functionality:
▪ chain_tasks, demonstrating the monadic chaining of tasks (and_then).
• Error and Result Handling:
Relationships and Data Flow
• User Code / Application Layer (examples/benchmarks/tests) on one side interacting with the library APIs.
• That when a user writes a coroutine (using the correct header such as start_tasks.h), it creates a coros::Task<T>.
• That after task submission, tasks run concurrently, with the thread pool managing the execution and resumption once awaited tasks are finished.
• Error propagation: if a task fails, the error is wrapped in std::expected and thus flows back through the chain – halting further chaining if an exception occurs.
Architectural Patterns & Design Principles
• Asynchronous Task Execution Pattern: Show how coroutines (with co_await and co_return) are central to asynchronous processing.
• Monadic Chaining: Visually represent the chain_tasks component (similar to chaining operations in functional programming) – illustrating sequential execution of tasks, where the output of one feeds as input into the next.
• Header-Only Library: Emphasize that all functionality is provided via header files (no separate binary); this is reflected by showing all core components within the “Library Core” section.
Technologies, Dependencies, and External Services
• Since this is a C++23 header-only library, include a note of the required compiler support (GCC 13, Clang 17, etc.) and that coroutines are core.
• Optionally, add a small note on continuous integration (GitHub Workflows) demonstrating that the library is tested across multiple configurations. This can be a boxed area that shows CI/CD as an external process ensuring quality.