= Motivation

Many programming languages
like node.js and python provide easy to use single-threaded concurrency frameworks.
While more complex than synchronous code,
single threaded asynchronicity avoids many of the pitfalls & overhead of multi-threading.

That is, one coroutine can work, while others wait for events (e.g. a response from a server).
This allows to write applications that *do multiple things simultaneously* on a *single thread*.

This library is meant to provide this to C++: *simple single threaded asynchronicity*
akin to node.js and asyncio in python that works with existing libraries like
`boost.beast`, `boost.mysql` or `boost.redis`.
It is based on `boost.asio`.

It takes a collection of concepts from other languages and provides them based on C++20 coroutines.

 - easy asynchronous base functions, such as an async <<main, main>> & <<thread, threads>>
 - <<promise, promise>> & <<generator, generator>> types
 - <<op, operation wrappers>>
 - an <<with, async scope>>
 - <<race, race>>
 - <<channel, channel>>

Unlike `asio::awaitable` and `asio::experimental::coro`, `cobalt` coroutines are open.
That is, an `asio::awaitable` can only await and be awaited by other `asio::awaitable`
and does not provide coroutine specific synchronization mechanisms.

`cobalt` on the other hand provides a coroutine specific `channel`
and different wait types (`race`, `gather` etc.) that are optimized
to work with coroutines and awaitables.

