asio-grpc v3.3.0
Asynchronous gRPC with Asio/unified executors
|
I/O object for grpc::Alarm
More...
#include <agrpc/alarm.hpp>
Public Types | |
using | executor_type = Executor |
The executor type. | |
Public Member Functions | |
BasicAlarm (const Executor &executor) | |
Construct a BasicAlarm from an executor. | |
BasicAlarm (agrpc::GrpcContext &grpc_context) | |
Construct a BasicAlarm from a GrpcContext. | |
template<class Deadline , class CompletionToken = detail::DefaultCompletionTokenT<Executor>> | |
auto | wait (const Deadline &deadline, CompletionToken &&token=CompletionToken{}) & |
Wait until a specified deadline has been reached (lvalue overload) | |
template<class Deadline , class CompletionToken = detail::DefaultCompletionTokenT<Executor>> | |
auto | wait (const Deadline &deadline, CompletionToken &&token=CompletionToken{}) && |
Wait until a specified deadline has been reached (rvalue overload) | |
void | cancel () |
Cancel an outstanding wait. | |
const executor_type & | get_executor () const noexcept |
Get the executor. | |
const executor_type & | get_scheduler () const noexcept |
Get the scheduler. | |
I/O object for grpc::Alarm
Wraps a grpc::Alarm as an I/O object.
Executor | The executor type, must be capable of referring to a GrpcContext. |
Per-Operation Cancellation
All. Effectively calls grpc::Alarm::Cancel which will cause the operation to complete with false
.
|
inline |
Wait until a specified deadline has been reached (lvalue overload)
The operation finishes once the alarm expires (at deadline) or is cancelled. If the alarm expired, the result will be true, false otherwise (i.e. upon cancellation).
Example:
deadline | By default gRPC supports two types of deadlines: gpr_timespec and std::chrono::system_clock::time_point . More types can be added by specializing grpc::TimePoint. |
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(bool) . true if it expired, false if it was canceled. |
|
inline |
Wait until a specified deadline has been reached (rvalue overload)
Extends the lifetime of the Alarm until the end of the wait. Otherwise, equivalent to the lvalue overload.
Example:
token | A completion token like asio::yield_context or the one created by agrpc::use_sender . The completion signature is void(bool, BasicAlarm) . true if it expired, false if it was canceled. |
|
inline |
Cancel an outstanding wait.
The outstanding wait will complete with false
if the Alarm did not fire yet, otherwise this function has no effect.
Thread-safe
|
inlinenodiscardnoexcept |
Get the executor.
Thread-safe
|
inlinenodiscardnoexcept |
Get the scheduler.
Thread-safe