aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Yash Tibrewal <yashkt@google.com>2018-11-05 13:41:04 -0800
committerGravatar GitHub <noreply@github.com>2018-11-05 13:41:04 -0800
commit673887d6d2b1c69a771ef157bca6906cf7cb6c4a (patch)
tree3c930ebc7cf3cc557da67370eac8e7f4aa37c62f
parent605e3bf8db4c2b686784f58d9ff7947fd096296f (diff)
parentf8561952e9b47060410dd0a70b1465f008c1218c (diff)
Merge pull request #17090 from yashykt/minor_cleanup1
Prefer lambda expressions over std::bind
-rw-r--r--src/cpp/client/secure_credentials.cc7
-rw-r--r--src/cpp/server/secure_server_credentials.cc7
-rw-r--r--src/cpp/server/server_cc.cc10
3 files changed, 12 insertions, 12 deletions
diff --git a/src/cpp/client/secure_credentials.cc b/src/cpp/client/secure_credentials.cc
index d1cd78e755..7faaa20e78 100644
--- a/src/cpp/client/secure_credentials.cc
+++ b/src/cpp/client/secure_credentials.cc
@@ -228,9 +228,10 @@ int MetadataCredentialsPluginWrapper::GetMetadata(
}
if (w->plugin_->IsBlocking()) {
// Asynchronous return.
- w->thread_pool_->Add(
- std::bind(&MetadataCredentialsPluginWrapper::InvokePlugin, w, context,
- cb, user_data, nullptr, nullptr, nullptr, nullptr));
+ w->thread_pool_->Add([w, context, cb, user_data] {
+ w->MetadataCredentialsPluginWrapper::InvokePlugin(
+ context, cb, user_data, nullptr, nullptr, nullptr, nullptr);
+ });
return 0;
} else {
// Synchronous return.
diff --git a/src/cpp/server/secure_server_credentials.cc b/src/cpp/server/secure_server_credentials.cc
index 536bf022dd..ebb17def32 100644
--- a/src/cpp/server/secure_server_credentials.cc
+++ b/src/cpp/server/secure_server_credentials.cc
@@ -43,9 +43,10 @@ void AuthMetadataProcessorAyncWrapper::Process(
return;
}
if (w->processor_->IsBlocking()) {
- w->thread_pool_->Add(
- std::bind(&AuthMetadataProcessorAyncWrapper::InvokeProcessor, w,
- context, md, num_md, cb, user_data));
+ w->thread_pool_->Add([w, context, md, num_md, cb, user_data] {
+ w->AuthMetadataProcessorAyncWrapper::InvokeProcessor(context, md, num_md,
+ cb, user_data);
+ });
} else {
// invoke directly.
w->InvokeProcessor(context, md, num_md, cb, user_data);
diff --git a/src/cpp/server/server_cc.cc b/src/cpp/server/server_cc.cc
index 870ee84e3e..c031528a8f 100644
--- a/src/cpp/server/server_cc.cc
+++ b/src/cpp/server/server_cc.cc
@@ -268,8 +268,8 @@ class Server::SyncRequest final : public internal::CompletionQueueTag {
interceptor_methods_.SetRecvMessage(request_);
}
- auto f = std::bind(&CallData::ContinueRunAfterInterception, this);
- if (interceptor_methods_.RunInterceptors(f)) {
+ if (interceptor_methods_.RunInterceptors(
+ [this]() { ContinueRunAfterInterception(); })) {
ContinueRunAfterInterception();
} else {
// There were interceptors to be run, so ContinueRunAfterInterception
@@ -981,10 +981,8 @@ bool ServerInterface::BaseAsyncRequest::FinalizeResult(void** tag,
interceptor_methods_.AddInterceptionHookPoint(
experimental::InterceptionHookPoints::POST_RECV_INITIAL_METADATA);
interceptor_methods_.SetRecvInitialMetadata(&context_->client_metadata_);
- auto f = std::bind(&ServerInterface::BaseAsyncRequest::
- ContinueFinalizeResultAfterInterception,
- this);
- if (interceptor_methods_.RunInterceptors(f)) {
+ if (interceptor_methods_.RunInterceptors(
+ [this]() { ContinueFinalizeResultAfterInterception(); })) {
// There are no interceptors to run. Continue
} else {
// There were interceptors to be run, so