Completion queues are thread-safe.
CallData is an application-level construct. gRPC itself won't be accessing 
the internals of the struct. It just uses it as an opaque pointer. If the 
application level logic is such that CallData can be accessed from multiple 
threads, you would need to synchronize access to it.

Hope that helps!

On Sunday, November 14, 2021 at 9:59:34 PM UTC-8 Rajanarayana A wrote:

> Hello, 
>
> Extremely sorry if this is a basic question. 
>
> I'm trying to work on the basic async gRPC C++ code as mentioned in 
> https://github.com/grpc/grpc/tree/master/examples/cpp/helloworld
>
> Aim is to experiment multi threading of RPC handlers. Can someone please 
> let me know that whether the programming logic is correct? ( Please refer 
> to the stackoverflow link -   
> https://stackoverflow.com/questions/69944030/is-this-a-valid-way-to-multi-thread-rpc-handlers-in-grpc-async-server-in-c
>  
> )
>
> Few questions,
>
>    - Is the completion queue thread-safe?
>    - I see that there is a possibility of one instance of CallData being 
>    accessed in multiple threads (returned as part of tag). Is CallData 
>    thread-safe here or do we need to have a mutex for the same?
>
> Please note that this is an incomplete program.
> Appreciate any help on this.
>
> Thanks and Regards,
> Raj
>
>

-- 
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/1b460abb-496d-4357-b6c4-413e45a4fc0dn%40googlegroups.com.

Reply via email to