aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2017-07-08 00:57:20 -0700
committerGravatar yang-g <yangg@google.com>2017-07-08 00:57:20 -0700
commita3d929169f469682b23d64ad89f955fadd493da8 (patch)
treeee2dd98d90634639bed3130df0385b4dbeaf6058 /include
parent05f6d7e5ae12a0eacc0dbdedcd964b2c379a8390 (diff)
Use pointer to avoid assignment and race.
Diffstat (limited to 'include')
-rw-r--r--include/grpc++/impl/codegen/async_unary_call.h26
1 files changed, 13 insertions, 13 deletions
diff --git a/include/grpc++/impl/codegen/async_unary_call.h b/include/grpc++/impl/codegen/async_unary_call.h
index a5a698c640..41b3ae3f28 100644
--- a/include/grpc++/impl/codegen/async_unary_call.h
+++ b/include/grpc++/impl/codegen/async_unary_call.h
@@ -123,18 +123,18 @@ class ClientAsyncResponseReader final
void ReadInitialMetadata(void* tag) {
GPR_CODEGEN_ASSERT(!context_->initial_metadata_received_);
- Ops& o = ops_;
+ Ops* o = &ops_;
// TODO(vjpai): Remove the collection_ specialization as soon
// as the public constructor is deleted
if (collection_) {
- o = *collection_;
+ o = collection_.get();
collection_->meta_buf.SetCollection(collection_);
}
- o.meta_buf.set_output_tag(tag);
- o.meta_buf.RecvInitialMetadata(context_);
- call_.PerformOps(&o.meta_buf);
+ o->meta_buf.set_output_tag(tag);
+ o->meta_buf.RecvInitialMetadata(context_);
+ call_.PerformOps(&o->meta_buf);
}
/// See \a ClientAysncResponseReaderInterface::Finish for semantics.
@@ -143,23 +143,23 @@ class ClientAsyncResponseReader final
/// - the \a ClientContext associated with this call is updated with
/// possible initial and trailing metadata sent from the server.
void Finish(R* msg, Status* status, void* tag) {
- Ops& o = ops_;
+ Ops* o = &ops_;
// TODO(vjpai): Remove the collection_ specialization as soon
// as the public constructor is deleted
if (collection_) {
- o = *collection_;
+ o = collection_.get();
collection_->finish_buf.SetCollection(collection_);
}
- o.finish_buf.set_output_tag(tag);
+ o->finish_buf.set_output_tag(tag);
if (!context_->initial_metadata_received_) {
- o.finish_buf.RecvInitialMetadata(context_);
+ o->finish_buf.RecvInitialMetadata(context_);
}
- o.finish_buf.RecvMessage(msg);
- o.finish_buf.AllowNoMessage();
- o.finish_buf.ClientRecvStatus(context_, status);
- call_.PerformOps(&o.finish_buf);
+ o->finish_buf.RecvMessage(msg);
+ o->finish_buf.AllowNoMessage();
+ o->finish_buf.ClientRecvStatus(context_, status);
+ call_.PerformOps(&o->finish_buf);
}
private: