A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
loop.h File Reference

A11's one libuv loop, and how to get work onto it. More...

#include <atomic>
#include <csignal>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <thread>
#include <utility>
#include <uvw.hpp>
#include <vector>
#include <absl/base/no_destructor.h>
#include <absl/base/thread_annotations.h>
#include <absl/container/flat_hash_map.h>
#include <absl/container/flat_hash_set.h>
#include <absl/log/log.h>
#include <absl/status/status.h>
#include <absl/status/status_macros.h>
#include <absl/status/statusor.h>
#include <absl/strings/numbers.h>
#include <absl/strings/str_cat.h>
#include <absl/time/clock.h>
#include <absl/time/time.h>
#include "a11/concurrency/future.h"
#include "thread/boost_primitives.h"

Go to the source code of this file.

Classes

class  a11::uv::UvExecutor
 

Namespaces

namespace  a11
 
namespace  a11::uv
 

Functions

absl::Status a11::uv::UvError (int code, std::string_view operation)
 The status a failed libuv call deserves.
 
template<typename T >
absl::StatusOr< T > a11::uv::RunOnUv (std::function< absl::StatusOr< T >()> operation, const void *order_key=nullptr)
 Run operation on the loop thread and wait for its result.
 
absl::Status a11::uv::RunStatusOnUv (std::function< absl::Status()> operation, const void *order_key=nullptr)
 

Detailed Description

A11's one libuv loop, and how to get work onto it.

A process-wide thread owns every uvw handle. Fibers submit work through Post() or RunOnUv() and receive results through A11 Futures.

Work sharing an order_key runs in posting order; use the connection as the key for operations on one socket. Drain() alternates between keys so a busy connection does not hold up unrelated work. A11_UV_FAIR=0 selects FIFO draining, and A11_UV_DRAIN_STATS=1 reports queue statistics at exit.