本文整理汇总了C++中Milliseconds::total_milliseconds方法的典型用法代码示例。如果您正苦于以下问题:C++ Milliseconds::total_milliseconds方法的具体用法?C++ Milliseconds::total_milliseconds怎么用?C++ Milliseconds::total_milliseconds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Milliseconds
的用法示例。
在下文中一共展示了Milliseconds::total_milliseconds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: incrementNow
void NetworkInterfaceMock::incrementNow(Milliseconds inc) {
boost::lock_guard<boost::mutex> lk(_mutex);
invariant(inc.total_milliseconds() > 0);
_now += inc.total_milliseconds();
_executor->signalWorkForTest();
_timeElapsed.notify_all();
}
示例2: _stepDownHelper
Status LegacyReplicationCoordinator::_stepDownHelper(OperationContext* txn,
bool force,
const Milliseconds& initialWaitTime,
const Milliseconds& stepdownTime,
const Milliseconds& postStepdownWaitTime) {
invariant(getReplicationMode() == modeReplSet);
if (!getCurrentMemberState().primary()) {
return Status(ErrorCodes::NotMaster, "not primary so can't step down");
}
if (!force) {
Status status = _waitForSecondary(initialWaitTime, Milliseconds(10 * 1000));
if (!status.isOK()) {
return status;
}
}
// step down
bool worked = repl::theReplSet->stepDown(txn, stepdownTime.total_seconds());
if (!worked) {
return Status(ErrorCodes::NotMaster, "not primary so can't step down");
}
if (postStepdownWaitTime.total_milliseconds() > 0) {
log() << "waiting for secondaries to catch up" << endl;
// The only caller of this with a non-zero postStepdownWaitTime is
// stepDownAndWaitForSecondary, and the only caller of that is the shutdown command
// which doesn't actually care if secondaries failed to catch up here, so we ignore the
// return status of _waitForSecondary
_waitForSecondary(postStepdownWaitTime, Milliseconds(0));
}
return Status::OK();
}