Clean shutdown of C++ client waiting for streaming data

737 views
Skip to first unread message

mfinal...@gmail.com

unread,
Sep 15, 2015, 6:55:32 PM9/15/15
to grpc.io
Hi,

How would one do a clean shutdown of a C++ that is currently blocking and waiting for streaming data? Looking at the router_guide example here:

The read call is blocking and won't return unless there is a problem with the underlying connection or the server returns a stream value. Is there a mechanism that I can use to poke the reader and cause the call to return?

Thanks.

Yang Gao

unread,
Sep 15, 2015, 7:17:04 PM9/15/15
to mfinal...@gmail.com, grpc.io
You can call TryCanel on the ClientContext on another thread. In this case, it will cancel the call and Read will return.

--
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+u...@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/1daa97b3-242b-4f3c-821f-aed02bc252d4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

mfinal...@gmail.com

unread,
Sep 17, 2015, 7:55:27 PM9/17/15
to grpc.io, mfinal...@gmail.com
That works for me! Thanks Yang!
Reply all
Reply to author
Forward
0 new messages