Skip to content

Commit

Permalink
feat: Associate executor and allocator of initiating function in grpc…
Browse files Browse the repository at this point in the history
…_initiate
  • Loading branch information
Tradias committed Aug 29, 2021
1 parent 24caf95 commit 5073ec9
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/agrpc/detail/initiate.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ namespace agrpc::detail
template <class Function>
struct GrpcInitiator
{
using executor_type = asio::associated_executor_t<Function>;
using allocator_type = asio::associated_allocator_t<Function>;

struct OnWork
{
agrpc::GrpcContext& grpc_context;
Expand All @@ -46,6 +49,10 @@ struct GrpcInitiator
detail::create_work<true>(grpc_context, std::move(completion_handler), OnWork{grpc_context, function},
allocator);
}

executor_type get_executor() const noexcept { return asio::get_associated_executor(function); }

allocator_type get_allocator() const noexcept { return asio::get_associated_allocator(function); }
};

template <class Function>
Expand Down

0 comments on commit 5073ec9

Please sign in to comment.