Skip to content

Commit

Permalink
Rename function to avoud future clash
Browse files Browse the repository at this point in the history
  • Loading branch information
ncteisen committed Jul 19, 2017
1 parent 30939f8 commit a5d557b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/cpp/client/secure_credentials.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void MetadataCredentialsPluginWrapper::InvokePlugin(

MetadataCredentialsPluginWrapper::MetadataCredentialsPluginWrapper(
std::unique_ptr<MetadataCredentialsPlugin> plugin)
: thread_pool_(CreateThreadPool()), plugin_(std::move(plugin)) {}
: thread_pool_(CreateDefaultThreadPool()), plugin_(std::move(plugin)) {}

std::shared_ptr<CallCredentials> MetadataCredentialsFromPlugin(
std::unique_ptr<MetadataCredentialsPlugin> plugin) {
Expand Down
12 changes: 4 additions & 8 deletions src/cpp/server/create_default_thread_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,17 @@

namespace grpc {

static ThreadPoolInterface* CreateDefaultThreadPool() {
static ThreadPoolInterface* CreateDefaultThreadPoolImpl() {
int cores = gpr_cpu_num_cores();
if (!cores) cores = 4;
return new DynamicThreadPool(cores);
}

static CreateThreadPoolFunc g_ctp_impl = CreateDefaultThreadPool;
static CreateThreadPoolFunc g_ctp_impl = CreateDefaultThreadPoolImpl;

ThreadPoolInterface* CreateThreadPool() {
return g_ctp_impl();
}
ThreadPoolInterface* CreateDefaultThreadPool() { return g_ctp_impl(); }

void SetCreateThreadPool(CreateThreadPoolFunc func) {
g_ctp_impl = func;
}
void SetCreateThreadPool(CreateThreadPoolFunc func) { g_ctp_impl = func; }

} // namespace grpc

Expand Down
2 changes: 1 addition & 1 deletion src/cpp/server/secure_server_credentials.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class AuthMetadataProcessorAyncWrapper final {

AuthMetadataProcessorAyncWrapper(
const std::shared_ptr<AuthMetadataProcessor>& processor)
: thread_pool_(CreateThreadPool()), processor_(processor) {}
: thread_pool_(CreateDefaultThreadPool()), processor_(processor) {}

private:
void InvokeProcessor(grpc_auth_context* context, const grpc_metadata* md,
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/server/thread_pool_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ThreadPoolInterface {
typedef ThreadPoolInterface* (*CreateThreadPoolFunc)(void);
void SetCreateThreadPool(CreateThreadPoolFunc func);

ThreadPoolInterface* CreateThreadPool();
ThreadPoolInterface* CreateDefaultThreadPool();

} // namespace grpc

Expand Down

0 comments on commit a5d557b

Please sign in to comment.