erikzenker / asyncly

C++ concurrent programming library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Asyncly

Asyncly

High level concurrency primitives for C++.


Never blocking: asyncly purposefully takes away all APIs that would allow your event loop to be blocked when waiting for an asynchronous operation to finish. We want to make it really easy to do the right thing and never block.

Works on top of your own runtime: asyncly works together with existing runtimes like boost::asio or libuv and makes it easy to plug in your own. This allows you to slowly migrate existing legacy code to high level concurrency primitives.

Composable: Primitives in asyncly are designed to compose well and support your software design instead of getting in the way.

Example

// asyncly does not contain an http client library,
// http is merely used as an example of an asynchronous operation
getHttpUrl("https://discovery/numberservice")
    .then([](auto responseFromDiscoveryService) {
        return getHttpUrl(responseFromDiscoveryService.body);
    })
    .then([](auto response) { std::cout << response.body << std::endl; })
    .catch_error([](auto exception) {
        try {
            std::rethrow_exception(exception);
        } catch (std::exception& e) {
            std::cout << e.what();
        });
    });

Features

  • Futures
  • Observables
  • Thread Pools
  • Executors
  • Object lifetime helpers
  • Experimental C++20 coroutine support
  • Multi platform support (used in production on these platforms)
    • Windows
    • MacOS
    • Linux
    • iOS
    • Android

Dependencies

  • C++14
  • Boost 1.72
  • prometheus-cpp
  • function2
  • Bazel or CMake

Contributing

See Contributing.md.

License

Apache 2.0

About

C++ concurrent programming library

License:Apache License 2.0


Languages

Language:C++ 96.7%Language:CMake 2.1%Language:Starlark 0.9%Language:C 0.3%