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

Completion values used by every asynchronous A11 operation. More...

#include <exception>
#include <functional>
#include <memory>
#include <optional>
#include <type_traits>
#include <utility>
#include <vector>
#include <absl/base/nullability.h>
#include <absl/functional/any_invocable.h>
#include <absl/log/log.h>
#include <absl/status/status.h>
#include <absl/status/statusor.h>
#include <absl/time/clock.h>
#include <absl/time/time.h>
#include "thread/boost_primitives.h"
#include "thread/fiber.h"
#include "thread/select.h"
#include "thread/selectables.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  a11::Unit
 Empty success value used by Future<Unit> operations that return no data. More...
 
class  a11::Future< T >
 Shared handle to one asynchronous result. More...
 
class  a11::Promise< T >
 Move-only producer for a Future result. More...
 

Namespaces

namespace  a11
 
namespace  a11::internal
 

Typedefs

using a11::Task = Future< Unit >
 Asynchronous operation whose only successful result is completion itself.
 

Functions

template<typename T >
void a11::internal::InvokeFutureCallback (absl::AnyInvocable< void(const absl::StatusOr< T > &)> callback, const absl::StatusOr< T > &result)
 
template<typename T >
Future< T > a11::SubmitWithCancellationHook (absl::AnyInvocable< absl::StatusOr< T >() && > work, std::function< void()> cancellation_hook, thread::TreeOptions tree_options={})
 Run work on A11's fiber pool with application-specific cancellation.
 
template<typename T >
Future< Ta11::Submit (absl::AnyInvocable< absl::StatusOr< T >() && > work, thread::TreeOptions tree_options)
 Run status-returning work on the fiber pool and expose its Future.
 
template<typename T >
Future< Ta11::ReadyFuture (T value)
 Return an already-successful future containing value.
 
template<typename T >
Future< Ta11::CompletedFuture (absl::StatusOr< T > result)
 Return an already-completed future containing result.
 
template<typename T >
Future< Ta11::FailedFuture (absl::Status status)
 Return an already-failed future containing status.
 
Task a11::ReadyTask ()
 Return an already-successful Task.
 
Task a11::FailedTask (absl::Status status)
 Return an already-failed Task.
 

Detailed Description

Completion values used by every asynchronous A11 operation.

Future and Promise carry an absl::StatusOr<T> between producers and consumers without exposing the fiber scheduler. Runtime code can await a Future from an A11 fiber or an ordinary OS thread, attach a non-blocking callback, or request cooperative cancellation.