Hello Christian Am Freitag, 12. Oktober 2018 12:12:16 UTC+2 schrieb Christian Rivasseau: > > > Then case to BaseMethod: > > bool ok; > while (true) { > if (!m_cq->Next(&tag, &ok)) break; > > MOOSE_ASSERT(ok); > static_cast<MyBaseMethod*>(tag)->proceed(); > } >
The pure inheritance solution you suggested was not very practical to me as I needed to have each call with it's own RequestType and ResponseType, which suggested a CRTP solution. I went for this plus some macros, which forced me to add an additional enum to identify the object and then static cast. Gotta say, lots of boilerplate I didn't see coming. Especially since the sync server where kind of neat and in-a-box. Anyway, it appears to work now and I can start tests next week. If I may still inquire, in case you or anybody else knows about the thread safety of the functions involved. The docs say somewhere that Next() is thread safe so multiple workers may serve requests. But what about the others involved? Specifically AsyncService::RequestMyMethod() and the shutdown methods Server::Shutdown() and CompletionQueue::Shutdown(). Can I safely have multiple threads doing a loop like we have them in the example? Thank you for your input! Stephan -- 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 post to this group, send email to grpc-io@googlegroups.com. 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/badfdc0e-69ba-4e60-a850-37c95e575778%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.