I want to have multiple async client threads (each thread may or may not communicate with a different server) that send requests asynchronously using a single global completion queue:
global cq:
CompletionQueue* cq = new CompletionQueue();
actual rpc call:
AsyncClientCall* call = new AsyncClientCall;
call->response_reader = stub_->AsyncRPC(&call->context, request, cq);
I also have multiple response collection threads, that wish to collect responses from this global cq using Next():
void* tag;
bool ok = false;
cq.Next(&tag, &ok);
I know that Next() is a thread safe operation. I want to find out if thread safety still exists between the client threads that are trying to send a request using the global cq, and the response collection threads that are listening on the same global cq.
If this design is not thread safe, what is the best way to implement this functionality without having to poll multiple completion queues?
Thanks!
Regards,
Akshitha