当前位置: 首页>>代码示例>>C++>>正文


C++ Milliseconds::total_milliseconds方法代码示例

本文整理汇总了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();
 }
开发者ID:DieterLutz,项目名称:mongo,代码行数:7,代码来源:network_interface_mock.cpp

示例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();
    }
开发者ID:QiangTimer,项目名称:mongo,代码行数:34,代码来源:repl_coordinator_legacy.cpp


注:本文中的Milliseconds::total_milliseconds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。