I created an issue in the github repo (
https://github.com/grpc/grpc/issues/18550) and realized this might be a 
better place to have a conversation about this topic:


The C# API's for the proto files consist of Task based client and server 
API's in the generated code - which allows for "await client->MethodAsync" 
to be invoked without blocking the thread.


For C++ though, I do not see this paradigm. The only available option seems 
like a polling based mechanism on a completion queue. I did notice a method 
named "AsyncNext" added by @vjpai <https://github.com/vjpai> , but again we 
need to provide a deadline and if there is a timeout, there is no good 
value to provide as the parameter the next time we need invoke the method 
as the caller has no idea how long it would take for the work to be done.


I am new to async programming patterns on linux environments and am 
wondering if I am missing something obvious. On windows, we have always 
passed callbacks in async API's. These callbacks are invoked by the callee 
with a context when the API is completed. This way, we never need to poll 
to check if the work is completed or not. Cancellations and timeouts are 
handled similarly as well.


In the C# API mentioned above, the await key word in .NET creates an 
implicit callback and yields the thread until the callback is ready to run. 
The new C++ standards (C++20) have also approved the coroutines into the 
standards and are expected to release it in the coming year.


Is there a reason the gRPC C++ API's were not designed this way? Any 
history or context would help greatly!

Thanks,
Sumukh

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/011927f8-b4d8-4795-b16d-93fed902b918%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to