That's correct. You can read more about the async API 
here https://grpc.io/docs/languages/cpp/async/, specifically where it says 
you have to call `Next` to poll for events. The callback API leverages 
gRPC-internal threads to execute application-provided callbacks. The 
callback API is described in more detail 
here: https://github.com/grpc/proposal/blob/master/L67-cpp-callback-api.md

On Thursday, October 20, 2022 at 5:03:26 PM UTC-7 Rohit Zambre wrote:

> Got it, thank you.
>
> This may be an orthogonal question -- does the async API (polling for 
> events on the completion queue) steal from the application's threads? In 
> other words, is the gRPC runtime running in the background even in the 
> async API?
> I have been using the async API under the assumption that the gRPC engine 
> is not invoked (except for accepting new connection requests) until I call 
> Next() or AsyncNext() on a completion queue.
>
> On Wed, Oct 19, 2022 at 11:36 AM 'AJ Heller' via grpc.io <
> grp...@googlegroups.com> wrote:
>
>> That's fine. You can replace the Wait call with 
>> `absl::SleepFor(absl::Seconds(42))` and it should work fine since the 
>> callback API does not need to borrow threads from the application. At 
>> shutdown, you'll still may want to wait on the gRPC server to finish doing 
>> its job before exiting, but that's a separate matter.
>> On Wednesday, October 12, 2022 at 3:13:35 PM UTC-7 Rohit Zambre wrote:
>>
>>> Hi,
>>>
>>> Is it possible to use the callback API without calling server->Wait()?
>>>
>>> In the route_guide example, I see that route_guide_callback_sever.cc 
>>> calls server->Wait(). In my use case, I cannot block on a call like Wait().
>>>
>>> Regards,
>>> Rohit
>>>
>> -- 
>> You received this message because you are subscribed to a topic in the 
>> Google Groups "grpc.io" group.
>> To unsubscribe from this topic, visit 
>> https://groups.google.com/d/topic/grpc-io/hnQ60W6hPMA/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> grpc-io+u...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/grpc-io/95ef746c-dd34-4a14-b7be-c10e9930e1can%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/grpc-io/95ef746c-dd34-4a14-b7be-c10e9930e1can%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/a3e3fbae-3ef6-46a7-877a-fa06f7e7f8abn%40googlegroups.com.

Reply via email to