multiple threaded cpp async server

43 views
Skip to first unread message

Przemysław Sobala

unread,
May 25, 2017, 3:56:01 AM5/25/17
to grpc.io
Hello
If I want to add more threads that process server communication can it be done by:
// run rpc handlers pool
for (int i = 0; i < threadsNo; i++) {
thread t(HandleRpcs, service, cq);
t.detach();
}
?

One CompletionQueue shared by multiple read/write threads
--
regards
Przemysław Sobala

Vijay Pai

unread,
May 25, 2017, 12:05:22 PM5/25/17
to grpc.io
Yes, you can have 1 cq shared by multiple threads; that is no problem. CQ operations are all thread-safe so you don't need additional locks just to use the cq.

- Vijay
Reply all
Reply to author
Forward
0 new messages