gpr_atm isn't automatically initialized to 0. Thanks Obama.

pull/8959/head
Vijay Pai 8 years ago
parent bf24dd9e51
commit 6510d47c81
  1. 5
      include/grpc++/impl/codegen/completion_queue.h
  2. 2
      src/cpp/common/completion_queue_cc.cc

@ -102,7 +102,7 @@ class CompletionQueue : private GrpcLibraryCodegen {
/// instance.
CompletionQueue() {
cq_ = g_core_codegen_interface->grpc_completion_queue_create(nullptr);
RegisterAvalanching(); // reserve this for the future shutdown
InitialAvalanching(); // reserve this for the future shutdown
}
/// Wrap \a take, taking ownership of the instance.
@ -174,6 +174,9 @@ class CompletionQueue : private GrpcLibraryCodegen {
/// been finalized. Note that we maintain the requirement that an avalanche
/// registration must take place before CQ shutdown (which must be maintained
/// elsehwere)
void InitialAvalanching() {
gpr_atm_rel_store(&avalanches_in_flight_, static_cast<gpr_atm>(1));
}
void RegisterAvalanching() {
gpr_atm_no_barrier_fetch_add(&avalanches_in_flight_,
static_cast<gpr_atm>(1));

@ -44,7 +44,7 @@ namespace grpc {
static internal::GrpcLibraryInitializer g_gli_initializer;
CompletionQueue::CompletionQueue(grpc_completion_queue* take) : cq_(take) {
RegisterAvalanching();
InitialAvalanching();
}
void CompletionQueue::Shutdown() { CompleteAvalanching(); }

Loading…
Cancel
Save