Instantiate tracking members regardless of NDEBUG

pull/21815/head
Vijay Pai 5 years ago
parent 6b2aeec9f3
commit 06ca713df0
  1. 11
      include/grpcpp/impl/codegen/completion_queue_impl.h
  2. 5
      include/grpcpp/server_impl.h

@ -406,14 +406,15 @@ class CompletionQueue : private ::grpc::GrpcLibraryCodegen {
return true;
}
#ifndef NDEBUG
mutable grpc::internal::Mutex server_list_mutex_;
std::list<const Server*> server_list_ /* GUARDED_BY(server_list_mutex_) */;
#endif
grpc_completion_queue* cq_; // owned
gpr_atm avalanches_in_flight_;
// List of servers associated with this CQ. Even though this is only used with
// NDEBUG, instantiate it in all cases since otherwise the size will be
// inconsistent.
mutable grpc::internal::Mutex server_list_mutex_;
std::list<const Server*> server_list_ /* GUARDED_BY(server_list_mutex_) */;
};
/// A specific type of completion queue used by the processing of notifications

@ -386,11 +386,10 @@ class Server : public grpc::ServerInterface, private grpc::GrpcLibraryCodegen {
// It is protected by mu_
CompletionQueue* callback_cq_ = nullptr;
#ifndef NDEBUG
// List of CQs passed in by user that must be Shutdown only after Server is
// Shutdown.
// Shutdown. Even though this is only used with NDEBUG, instantiate it in all
// cases since otherwise the size will be inconsistent.
std::vector<CompletionQueue*> cq_list_;
#endif
};
} // namespace grpc_impl

Loading…
Cancel
Save