提交 1bc61c75 编写于 作者: fengqikai1414's avatar fengqikai1414 提交者: Liangliang Zhang

framework: update SleepFor implement

上级 7e1aa4c4
......@@ -41,10 +41,11 @@ static inline void Yield() {
template <typename Rep, typename Period>
static void SleepFor(const std::chrono::duration<Rep, Period>& sleep_duration) {
if (croutine::CRoutine::GetCurrentRoutine()) {
croutine::CRoutine::Sleep(sleep_duration);
} else {
auto routine = croutine::CRoutine::GetCurrentRoutine();
if (routine == nullptr) {
std::this_thread::sleep_for(sleep_duration);
} else {
routine->Sleep(sleep_duration);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册