diff options
Diffstat (limited to 'include/grpc++/impl/codegen/grpc_library.h')
-rw-r--r-- | include/grpc++/impl/codegen/grpc_library.h | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/include/grpc++/impl/codegen/grpc_library.h b/include/grpc++/impl/codegen/grpc_library.h index eb7152a2c6..3cdc6f3f7c 100644 --- a/include/grpc++/impl/codegen/grpc_library.h +++ b/include/grpc++/impl/codegen/grpc_library.h @@ -34,6 +34,7 @@ #ifndef GRPCXX_IMPL_CODEGEN_GRPC_LIBRARY_H #define GRPCXX_IMPL_CODEGEN_GRPC_LIBRARY_H +#include <grpc++/impl/codegen/core_codegen_interface.h> #include <grpc/impl/codegen/log.h> namespace grpc { @@ -44,24 +45,27 @@ class GrpcLibraryInterface { virtual void shutdown() = 0; }; +/// Initialized by \a grpc::GrpcLibraryInitializer from +/// <grpc++/impl/grpc_library.h> extern GrpcLibraryInterface* g_glip; -class GrpcLibrary { +/// Classes that require gRPC to be initialized should inherit from this class. +class GrpcLibraryCodegen { public: - GrpcLibrary() { - GPR_ASSERT(g_glip && - "gRPC library not initialized. See " - "grpc::internal::GrpcLibraryInitializer."); + GrpcLibraryCodegen() { + GPR_CODEGEN_ASSERT(g_glip && + "gRPC library not initialized. See " + "grpc::internal::GrpcLibraryInitializer."); g_glip->init(); } - virtual ~GrpcLibrary() { - GPR_ASSERT(g_glip && - "gRPC library not initialized. See " - "grpc::internal::GrpcLibraryInitializer."); + virtual ~GrpcLibraryCodegen() { + GPR_CODEGEN_ASSERT(g_glip && + "gRPC library not initialized. See " + "grpc::internal::GrpcLibraryInitializer."); g_glip->shutdown(); } }; } // namespace grpc -#endif // GRPCXX_IMPL_GRPC_LIBRARY_H +#endif // GRPCXX_IMPL_CODEGEN_GRPC_LIBRARY_H |