To elaborate on @QuavePL’s answer - I believe the idea is that all the public functions in AsyncService should return as quickly as possible and have their work done asynchronously (for example in another thread, and in this case on the main thread) and call ‘Finish()’ when they are done (when they populated the response object, ideally). This quick return “ensures” that the gRPC thread isn’t blocked.
Correct answers above. We need to handle the request in a separate thread for asynchronous handling and return the call from the gRPC thread directly. I just picked boost asio as an example since it is pretty easy to work with.
I cant understand why boost asio post is used!
as async task executor
To elaborate on @QuavePL’s answer - I believe the idea is that all the public functions in AsyncService should return as quickly as possible and have their work done asynchronously (for example in another thread, and in this case on the main thread) and call ‘Finish()’ when they are done (when they populated the response object, ideally). This quick return “ensures” that the gRPC thread isn’t blocked.
Correct answers above. We need to handle the request in a separate thread for asynchronous handling and return the call from the gRPC thread directly. I just picked boost asio as an example since it is pretty easy to work with.