What is Corral and how does it work?
masterCorral is a lightweight C++20 library for cooperative, single-threaded multitasking using coroutines. It implements structured concurrency, meaning tasks are organized into a parent-child tree. Parents are responsible for:
- Waiting for all children to finish.
- Propagating exceptions raised by children.
This design ensures that resource management, task cancellation, and error handling behave predictably. Because it uses cooperative multitasking in a single-threaded environment, you have exclusive access to all state between co_await points, reducing concurrency hazards. You can run multiple 'corral universes' by having multiple threads, each running its own independent corral instance, provided tasks in different threads do not interact.