diff options
author | Arseny Smalyuk <smalukav@gmail.com> | 2022-02-10 16:48:05 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:48:05 +0300 |
commit | 12559cd7f2fa0cf54ffb0d961949fea58c0e18cb (patch) | |
tree | 1c6e1bb383ce1ed8ea168386f913410dd55ccb7f /library/cpp/coroutine/engine/impl.cpp | |
parent | 5b8d95df2f0cfca4d3f5499a4259aa2050ef1571 (diff) | |
download | ydb-12559cd7f2fa0cf54ffb0d961949fea58c0e18cb.tar.gz |
Restoring authorship annotation for Arseny Smalyuk <smalukav@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/coroutine/engine/impl.cpp')
-rw-r--r-- | library/cpp/coroutine/engine/impl.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/library/cpp/coroutine/engine/impl.cpp b/library/cpp/coroutine/engine/impl.cpp index 7ae6f74051..578d06498b 100644 --- a/library/cpp/coroutine/engine/impl.cpp +++ b/library/cpp/coroutine/engine/impl.cpp @@ -119,14 +119,14 @@ void TCont::ReSchedule() noexcept { TContExecutor::TContExecutor( uint32_t defaultStackSize, THolder<IPollerFace> poller, - NCoro::IScheduleCallback* scheduleCallback, - NCoro::IEnterPollerCallback* enterPollerCallback, + NCoro::IScheduleCallback* scheduleCallback, + NCoro::IEnterPollerCallback* enterPollerCallback, NCoro::NStack::EGuard defaultGuard, TMaybe<NCoro::NStack::TPoolAllocatorSettings> poolSettings, NCoro::ITime* time ) - : ScheduleCallback_(scheduleCallback) - , EnterPollerCallback_(enterPollerCallback) + : ScheduleCallback_(scheduleCallback) + , EnterPollerCallback_(enterPollerCallback) , DefaultStackSize_(defaultStackSize) , Poller_(std::move(poller)) , Time_(time) @@ -171,21 +171,21 @@ void TContExecutor::WaitForIO() { // to prevent ourselves from locking out of io by constantly waking coroutines. if (ReadyNext_.Empty()) { - if (EnterPollerCallback_) { - EnterPollerCallback_->OnEnterPoller(); - } + if (EnterPollerCallback_) { + EnterPollerCallback_->OnEnterPoller(); + } Poll(next); - if (EnterPollerCallback_) { - EnterPollerCallback_->OnExitPoller(); - } + if (EnterPollerCallback_) { + EnterPollerCallback_->OnExitPoller(); + } } else if (LastPoll_ + TDuration::MilliSeconds(5) < now) { - if (EnterPollerCallback_) { - EnterPollerCallback_->OnEnterPoller(); - } + if (EnterPollerCallback_) { + EnterPollerCallback_->OnEnterPoller(); + } Poll(now); - if (EnterPollerCallback_) { - EnterPollerCallback_->OnExitPoller(); - } + if (EnterPollerCallback_) { + EnterPollerCallback_->OnExitPoller(); + } } Ready_.Append(ReadyNext_); @@ -296,8 +296,8 @@ TCont* RunningCont() { return thisThreadExecutor ? thisThreadExecutor->Running() : nullptr; } -void TContExecutor::RunScheduler() noexcept { - try { +void TContExecutor::RunScheduler() noexcept { + try { TContExecutor* const prev = ThisThreadExecutor(); ThisThreadExecutor() = this; TCont* caller = Current_; @@ -306,27 +306,27 @@ void TContExecutor::RunScheduler() noexcept { ThisThreadExecutor() = prev; }; - while (true) { - if (ScheduleCallback_ && Current_) { - ScheduleCallback_->OnUnschedule(*this); + while (true) { + if (ScheduleCallback_ && Current_) { + ScheduleCallback_->OnUnschedule(*this); } WaitForIO(); DeleteScheduled(); - Ready_.Append(ReadyNext_); + Ready_.Append(ReadyNext_); - if (Ready_.Empty()) { + if (Ready_.Empty()) { Current_ = nullptr; if (caller) { context->SwitchTo(&SchedContext_); } - break; - } + break; + } TCont* cont = Ready_.PopFront(); - if (ScheduleCallback_) { - ScheduleCallback_->OnSchedule(*this, *cont); + if (ScheduleCallback_) { + ScheduleCallback_->OnSchedule(*this, *cont); } Current_ = cont; @@ -343,8 +343,8 @@ void TContExecutor::RunScheduler() noexcept { if (caller) { break; } - } - } catch (...) { + } + } catch (...) { TBackTrace::FromCurrentException().PrintTo(Cerr); Y_FAIL("Uncaught exception in the scheduler: %s", CurrentExceptionMessage().c_str()); } |