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

Driving a state-machine pump on whichever thread asked it for something. More...

#include <cstddef>
#include <exception>
#include <string_view>
#include <utility>
#include <absl/log/log.h>
#include <absl/strings/str_cat.h>
#include "a11/exception_guard.h"
#include "thread/boost_primitives.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  a11::InlinePumpState
 Re-entry bookkeeping for a pump that may be driven from any thread. More...
 

Namespaces

namespace  a11
 

Functions

template<typename Once >
void a11::DriveInline (thread::Mutex *absl_nonnull mu, InlinePumpState *absl_nonnull state, std::string_view name, Once &&once, size_t max_depth=4)
 Run once until the pump has nothing left to do without waiting.
 
bool a11::PumpIsDriving (const InlinePumpState &state)
 Whether a DriveInline() turn for this pump is running right now.
 

Detailed Description

Driving a state-machine pump on whichever thread asked it for something.

A11's pumps – the chunk store reader and writer, and anything else built the same way – run on whichever thread asks them for something, rather than only on the worker pool. Waking a worker and waiting costs a scheduler hop to do work the caller could do in the frame it is already in, and through a language binding an event-loop turn on top of that.

Completing work runs the caller's continuation, which may ask the pump for more work and re-enter it. This helper bounds that re-entry.