Motivation
Many languages provide a simple 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 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 & threads
-
an async scope
Unlike asio::awaitable
and asio::experimental::coro
, async
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.
async
on the other hand provides a coroutine specific channel
and different wait types (select
, gather
etc.) that are optimized
to work with coroutines and awaitables.