diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cpp/client/channel.cc | 3 | ||||
-rw-r--r-- | src/cpp/client/credentials.cc | 7 | ||||
-rw-r--r-- | src/cpp/client/secure_credentials.cc | 3 | ||||
-rw-r--r-- | src/cpp/common/alarm.cc | 3 | ||||
-rw-r--r-- | src/cpp/common/completion_queue.cc | 3 | ||||
-rw-r--r-- | src/cpp/common/grpc_library_initializer.cc | 41 | ||||
-rw-r--r-- | src/cpp/server/server.cc | 3 |
7 files changed, 13 insertions, 50 deletions
diff --git a/src/cpp/client/channel.cc b/src/cpp/client/channel.cc index 9b87102f17..ae20392d11 100644 --- a/src/cpp/client/channel.cc +++ b/src/cpp/client/channel.cc @@ -53,9 +53,10 @@ namespace grpc { +static internal::GrpcLibraryInitializer g_gli_initializer; Channel::Channel(const grpc::string& host, grpc_channel* channel) : host_(host), c_channel_(channel) { - internal::g_gli_initializer.summon(); + g_gli_initializer.summon(); } Channel::~Channel() { grpc_channel_destroy(c_channel_); } diff --git a/src/cpp/client/credentials.cc b/src/cpp/client/credentials.cc index 51b520bf83..6fb620b0ea 100644 --- a/src/cpp/client/credentials.cc +++ b/src/cpp/client/credentials.cc @@ -36,13 +36,12 @@ namespace grpc { -ChannelCredentials::ChannelCredentials() { - internal::g_gli_initializer.summon(); -} +static internal::GrpcLibraryInitializer g_gli_initializer; +ChannelCredentials::ChannelCredentials() { g_gli_initializer.summon(); } ChannelCredentials::~ChannelCredentials() {} -CallCredentials::CallCredentials() { internal::g_gli_initializer.summon(); } +CallCredentials::CallCredentials() { g_gli_initializer.summon(); } CallCredentials::~CallCredentials() {} diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc index bfbcc5f915..074dae7ca7 100644 --- a/src/cpp/client/secure_credentials.cc +++ b/src/cpp/client/secure_credentials.cc @@ -41,10 +41,11 @@ namespace grpc { +static internal::GrpcLibraryInitializer g_gli_initializer; SecureChannelCredentials::SecureChannelCredentials( grpc_channel_credentials* c_creds) : c_creds_(c_creds) { - internal::g_gli_initializer.summon(); + g_gli_initializer.summon(); } std::shared_ptr<grpc::Channel> SecureChannelCredentials::CreateChannel( diff --git a/src/cpp/common/alarm.cc b/src/cpp/common/alarm.cc index 604e2c2967..807a67df24 100644 --- a/src/cpp/common/alarm.cc +++ b/src/cpp/common/alarm.cc @@ -37,9 +37,10 @@ namespace grpc { +static internal::GrpcLibraryInitializer g_gli_initializer; Alarm::Alarm(CompletionQueue* cq, gpr_timespec deadline, void* tag) : alarm_(grpc_alarm_create(cq->cq(), deadline, tag)) { - internal::g_gli_initializer.summon(); + g_gli_initializer.summon(); } Alarm::~Alarm() { grpc_alarm_destroy(alarm_); } diff --git a/src/cpp/common/completion_queue.cc b/src/cpp/common/completion_queue.cc index 0f7b6f63a3..4f76dfff1d 100644 --- a/src/cpp/common/completion_queue.cc +++ b/src/cpp/common/completion_queue.cc @@ -42,8 +42,9 @@ namespace grpc { +static internal::GrpcLibraryInitializer g_gli_initializer; CompletionQueue::CompletionQueue() { - internal::g_gli_initializer.summon(); + g_gli_initializer.summon(); cq_ = grpc_completion_queue_create(nullptr); } diff --git a/src/cpp/common/grpc_library_initializer.cc b/src/cpp/common/grpc_library_initializer.cc deleted file mode 100644 index 171efc9238..0000000000 --- a/src/cpp/common/grpc_library_initializer.cc +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2016, Google Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include <grpc++/impl/grpc_library.h> - -namespace grpc { -namespace internal { - -GrpcLibraryInitializer g_gli_initializer; - -} // namespace internal -} // namespace grpc diff --git a/src/cpp/server/server.cc b/src/cpp/server/server.cc index 1fe0a1eefd..0d31140924 100644 --- a/src/cpp/server/server.cc +++ b/src/cpp/server/server.cc @@ -278,6 +278,7 @@ static grpc_server* CreateServer(const ChannelArguments& args) { return grpc_server_create(&channel_args, nullptr); } +static internal::GrpcLibraryInitializer g_gli_initializer; Server::Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned, int max_message_size, const ChannelArguments& args) : max_message_size_(max_message_size), @@ -289,7 +290,7 @@ Server::Server(ThreadPoolInterface* thread_pool, bool thread_pool_owned, server_(CreateServer(args)), thread_pool_(thread_pool), thread_pool_owned_(thread_pool_owned) { - internal::g_gli_initializer.summon(); + g_gli_initializer.summon(); gpr_once_init(&g_once_init_callbacks, InitGlobalCallbacks); global_callbacks_ = g_callbacks; grpc_server_register_completion_queue(server_, cq_.cq(), nullptr); |