Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
async.hh File Reference
#include "nix/util/callback.hh"
#include "nix/util/ref.hh"
#include "nix/util/signals.hh"
#include <boost/asio/co_spawn.hpp>
#include <boost/asio/io_context.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/awaitable.hpp>
#include <boost/asio/use_awaitable.hpp>
#include <boost/asio/associated_cancellation_slot.hpp>
#include <concepts>

Go to the source code of this file.

Functions

template<typename T, std::invocable< Callback< T > > F, typename CompletionToken>
auto nix::callbackToAwaitable (F &&initiate, CompletionToken &&token)
template<typename T, std::invocable< Callback< T > > F>
asio::awaitable< T > nix::callbackToAwaitable (F &&initiate)
template<typename Range, typename F>
asio::awaitable< void > nix::forEachAsync (Range &&range, const F &f)

Function Documentation

◆ callbackToAwaitable()

template<typename T, std::invocable< Callback< T > > F>
asio::awaitable< T > nix::callbackToAwaitable ( F && initiate)

Convert a completion handler callback into a stackless coroutine. The callback can be invoked on any thread and the completion handler will be marshalled to the coroutines executer.