本文整理汇总了C++中Milliseconds::toSystemDuration方法的典型用法代码示例。如果您正苦于以下问题:C++ Milliseconds::toSystemDuration方法的具体用法?C++ Milliseconds::toSystemDuration怎么用?C++ Milliseconds::toSystemDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Milliseconds
的用法示例。
在下文中一共展示了Milliseconds::toSystemDuration方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wait
LockResult CondVarLockGrantNotification::wait(Milliseconds timeout) {
stdx::unique_lock<stdx::mutex> lock(_mutex);
return _cond.wait_for(
lock, timeout.toSystemDuration(), [this] { return _result != LOCK_INVALID; })
? _result
: LOCK_TIMEOUT;
}
示例2: waitForWorkUntil
void NetworkInterfaceASIO::waitForWorkUntil(Date_t when) {
stdx::unique_lock<stdx::mutex> lk(_executorMutex);
// TODO: This can be restructured with a lambda.
while (!_isExecutorRunnable) {
const Milliseconds waitTime(when - now());
if (waitTime <= Milliseconds(0)) {
break;
}
_isExecutorRunnableCondition.wait_for(lk, waitTime.toSystemDuration());
}
_isExecutorRunnable = false;
}
示例3: shutdown
Status ServiceExecutorReserved::shutdown(Milliseconds timeout) {
LOG(3) << "Shutting down reserved executor";
stdx::unique_lock<stdx::mutex> lock(_mutex);
_stillRunning.store(false);
_threadWakeup.notify_all();
bool result = _shutdownCondition.wait_for(lock, timeout.toSystemDuration(), [this]() {
return _numRunningWorkerThreads.load() == 0;
});
return result
? Status::OK()
: Status(ErrorCodes::Error::ExceededTimeLimit,
"reserved executor couldn't shutdown all worker threads within time limit.");
}
示例4:
AsyncTimerASIO::AsyncTimerASIO(asio::io_service::strand* strand, Milliseconds expiration)
: _strand(strand), _timer(_strand->get_io_service(), expiration.toSystemDuration()) {}