C++ : lifetime of stream requests?

74 views
Skip to first unread message

Christian Rivasseau

unread,
Dec 29, 2016, 11:30:05 AM12/29/16
to grpc-io
Hi,

in ClientAsyncReaderWriter::Write(const T& msg, tag),
is it OK do delete 'msg' after Write() returns, or should it be
kept alive until 'tag' was notified?

Thanks a lot,


--
Christian Rivasseau
Co-founder and CTO @ Lefty
+33 6 67 35 26 74

Vijay Pai

unread,
Jan 24, 2017, 8:12:17 PM1/24/17
to grpc.io
Excellent question! From a C++ API perspective, we only guarantee that any part of the Write (including serialization) is done when the tag is posted, so the only safe option is to keep the data valid until the tag is posted. This may become an issue, for example, for serialization alternatives or optimizations.

Regards,
Vijay
Reply all
Reply to author
Forward
0 new messages