jeudi 29 novembre 2018

How to cancel a Read() call for grpc::ClientReader in C++?

I have code that requests a stream of data from a grpc::Server with a grpc::ClientReader. The main loop looks like below, and runs in a seperate task. I need to shutdown task when destructor, but the Read() method is blocking. There doesn't seem to be anything I can do to mcReader to get it to stop blocking. I would rather not use deadline, because data isn't completely periodic, and making it big enough to do antyhign would still block a long time. What should I do?

while (mcReader->Read(&dataProductWrapper) && meTasksRunning) 
{
      // Do some work.
}

Aucun commentaire:

Enregistrer un commentaire