asio-grpc v1.5.0
Asynchronous gRPC with Asio/unified executors
|
(experimental) Helper class to run a GrpcContext in a different execution context More...
#include <agrpc/pollContext.hpp>
Public Member Functions | |
template<class Exec > | |
PollContext (Exec &&executor) | |
Construct a PollContext from an Executor. | |
void | async_poll (agrpc::GrpcContext &grpc_context) |
Repeatedly call .poll() on the GrpcContext until it is stopped. | |
template<class StopPredicate > | |
void | async_poll (agrpc::GrpcContext &grpc_context, StopPredicate stop_predicate) |
Repeatedly call .poll() on the GrpcContext until the provided StopPredicate returns true. More... | |
(experimental) Helper class to run a GrpcContext in a different execution context
Example showing how to share a thread with an asio::io_context
:
Executor | The executor type |
Traits | The traits type, defaults to agrpc::DefaultPollContextTraits . If the static assertion 'OneShotAllocator has insufficient capacity' triggers then inherit from the default to increase the buffer size of the PollContext. Example: struct MyTraits : agrpc::DefaultPollContextTraits
{
static constexpr std::size_t BUFFER_SIZE = 128;
}
(experimental) Default PollContext traits Definition: pollContext.hpp:32 |
|
inline |
Repeatedly call .poll() on the GrpcContext until the provided StopPredicate returns true.
stop_predicate | A function that returns true when the polling should stop. Its signature should be bool(agrpc::GrpcContext&) . |