summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replication_coordinator_impl.cpp
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2017-12-06 14:40:59 -0500
committerBilly Donahue <billy.donahue@mongodb.com>2017-12-14 17:50:41 -0500
commit950fa6e6fd8f46248796dea3bc6c2392757b163d (patch)
tree2556f9322ee634477fc54b6876653b8ea702b8fa /src/mongo/db/repl/replication_coordinator_impl.cpp
parentd2eedbeeedb61753c17b6a87912e4b14e7611b95 (diff)
downloadmongo-950fa6e6fd8f46248796dea3bc6c2392757b163d.tar.gz
SERVER-32070 migrate some easy stdx::bind to lambdas (pt3)
Diffstat (limited to 'src/mongo/db/repl/replication_coordinator_impl.cpp')
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp59
1 files changed, 21 insertions, 38 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index 3dd9826e018..0f01a1aad4d 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -503,12 +503,9 @@ bool ReplicationCoordinatorImpl::_startLoadLocalConfig(OperationContext* opCtx)
// that the server's networking layer be up and running and accepting connections, which
// doesn't happen until startReplication finishes.
auto handle =
- _replExecutor->scheduleWork(stdx::bind(&ReplicationCoordinatorImpl::_finishLoadLocalConfig,
- this,
- stdx::placeholders::_1,
- localConfig,
- lastOpTimeStatus,
- lastVote));
+ _replExecutor->scheduleWork([=](const executor::TaskExecutor::CallbackArgs& args) {
+ _finishLoadLocalConfig(args, localConfig, lastOpTimeStatus, lastVote);
+ });
if (handle == ErrorCodes::ShutdownInProgress) {
handle = CallbackHandle{};
}
@@ -1782,9 +1779,9 @@ Status ReplicationCoordinatorImpl::stepDown(OperationContext* opCtx,
onExitGuard.Dismiss();
updateMemberState();
// Schedule work to (potentially) step back up once the stepdown period has ended.
- _scheduleWorkAt(
- stepDownUntil,
- stdx::bind(&ReplicationCoordinatorImpl::_handleTimePassing, this, stdx::placeholders::_1));
+ _scheduleWorkAt(stepDownUntil, [=](const executor::TaskExecutor::CallbackArgs& cbData) {
+ _handleTimePassing(cbData);
+ });
return Status::OK();
}
@@ -2246,10 +2243,8 @@ Status ReplicationCoordinatorImpl::processReplSetReconfig(OperationContext* opCt
}
_setConfigState_inlock(kConfigReconfiguring);
- ScopeGuard configStateGuard = MakeGuard(
- lockAndCall,
- &lk,
- stdx::bind(&ReplicationCoordinatorImpl::_setConfigState_inlock, this, kConfigSteady));
+ ScopeGuard configStateGuard =
+ MakeGuard(lockAndCall, &lk, [=] { _setConfigState_inlock(kConfigSteady); });
ReplSetConfig oldConfig = _rsConfig;
lk.unlock();
@@ -2303,14 +2298,10 @@ Status ReplicationCoordinatorImpl::processReplSetReconfig(OperationContext* opCt
}
auto reconfigFinished = uassertStatusOK(_replExecutor->makeEvent());
- uassertStatusOK(
- _replExecutor->scheduleWork(stdx::bind(&ReplicationCoordinatorImpl::_finishReplSetReconfig,
- this,
- stdx::placeholders::_1,
- newConfig,
- args.force,
- myIndex.getValue(),
- reconfigFinished)));
+ uassertStatusOK(_replExecutor->scheduleWork([ =, f = args.force, v = myIndex.getValue() ](
+ const executor::TaskExecutor::CallbackArgs& cbData) {
+ _finishReplSetReconfig(cbData, newConfig, f, v, reconfigFinished);
+ }));
configStateGuard.Dismiss();
_replExecutor->waitForEvent(reconfigFinished);
return Status::OK();
@@ -2344,13 +2335,10 @@ void ReplicationCoordinatorImpl::_finishReplSetReconfig(
// Wait for the election to complete and the node's Role to be set to follower.
_replExecutor
->onEvent(electionFinishedEvent,
- stdx::bind(&ReplicationCoordinatorImpl::_finishReplSetReconfig,
- this,
- stdx::placeholders::_1,
- newConfig,
- isForceReconfig,
- myIndex,
- finishedEvent))
+ [=](const executor::TaskExecutor::CallbackArgs& cbData) {
+ _finishReplSetReconfig(
+ cbData, newConfig, isForceReconfig, myIndex, finishedEvent);
+ })
.status_with_transitional_ignore();
return;
}
@@ -2390,11 +2378,8 @@ Status ReplicationCoordinatorImpl::processReplSetInitiate(OperationContext* opCt
invariant(!_rsConfig.isInitialized());
_setConfigState_inlock(kConfigInitiating);
- ScopeGuard configStateGuard = MakeGuard(
- lockAndCall,
- &lk,
- stdx::bind(
- &ReplicationCoordinatorImpl::_setConfigState_inlock, this, kConfigUninitialized));
+ ScopeGuard configStateGuard =
+ MakeGuard(lockAndCall, &lk, [=] { _setConfigState_inlock(kConfigUninitialized); });
lk.unlock();
ReplSetConfig newConfig;
@@ -3079,11 +3064,9 @@ void ReplicationCoordinatorImpl::_unblacklistSyncSource(
void ReplicationCoordinatorImpl::blacklistSyncSource(const HostAndPort& host, Date_t until) {
stdx::lock_guard<stdx::mutex> lock(_mutex);
_topCoord->blacklistSyncSource(host, until);
- _scheduleWorkAt(until,
- stdx::bind(&ReplicationCoordinatorImpl::_unblacklistSyncSource,
- this,
- stdx::placeholders::_1,
- host));
+ _scheduleWorkAt(until, [=](const executor::TaskExecutor::CallbackArgs& cbData) {
+ _unblacklistSyncSource(cbData, host);
+ });
}
void ReplicationCoordinatorImpl::resetLastOpTimesFromOplog(OperationContext* opCtx,