32#ifndef A11_CONCURRENCY_INLINE_PUMP_H_
33#define A11_CONCURRENCY_INLINE_PUMP_H_
40#include <absl/log/log.h>
41#include <absl/strings/str_cat.h>
44#include "thread/boost_primitives.h"
92template <
typename Once>
95 Once&& once,
size_t max_depth = 4) {
97 thread::MutexLock lock(
mu);
98 if (state->depth >= max_depth) {
107 const absl::Status raised =
110 LOG(ERROR) << raised.message();
112 thread::MutexLock lock(
mu);
117 state->again =
false;
131 return state.
depth > 0;
Turns what a caller's callable throws into a Status, at the boundary.
thread::Mutex mu
Definition executor.cc:32
absl::Status Attempt(Callable &&callable, std::string_view what)
Runs callable, reporting anything it throws as a Status.
Definition exception_guard.h:114
void 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.
Definition inline_pump.h:93
bool PumpIsDriving(const InlinePumpState &state)
Whether a DriveInline() turn for this pump is running right now.
Definition inline_pump.h:130
Re-entry bookkeeping for a pump that may be driven from any thread.
Definition inline_pump.h:56
size_t depth
Live DriveInline() calls for this pump, across all threads.
Definition inline_pump.h:58
bool again
Set by a call turned away at the cap; a running turn owes it a pass.
Definition inline_pump.h:60