C++20 event-loop agnostic coroutines (co_await
/co_return
) implementation + support for libuv and curl.
Event loop-agnostic implementation of C++20 coroutines (co_await
/co_return
).
Provides makeTask
function which takes a callback with resolve
and reject
passed as arguments. Similar to how JavaScript new Promise
constructor works. With cancellation support (C# way).
libuv library wrappers for usage with C++ std::function.
libuv OpenSSL TLS implementation.
libuv library wrappers to be used in coroutine-based program.
Implemented functions:
uvSleep
- waits passed amount of time before continuing.
libuv based, coroutine API for curl.
#include <asyncpp_uv/asyncpp_uv.h>
#include <uv.h>
asyncpp::task<void> asyncMain() {
printf("asyncMain BEGIN\n");
auto timer1 = asyncpp_uv::uvSleepAsync(1000);
auto timer2 = asyncpp_uv::uvSleepAsync(1000);
co_await timer1;
co_await timer2;
printf("asyncMain END\n");
}
int main() {
asyncMain();
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
return 0;
}