aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/coroutine/engine/cont_poller.cpp
diff options
context:
space:
mode:
authorRuslan Kovalev <ruslan.a.kovalev@gmail.com>2022-02-10 16:46:45 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:45 +0300
commit9123176b341b6f2658cff5132482b8237c1416c8 (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /library/cpp/coroutine/engine/cont_poller.cpp
parent59e19371de37995fcb36beb16cd6ec030af960bc (diff)
downloadydb-9123176b341b6f2658cff5132482b8237c1416c8.tar.gz
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/coroutine/engine/cont_poller.cpp')
-rw-r--r--library/cpp/coroutine/engine/cont_poller.cpp128
1 files changed, 64 insertions, 64 deletions
diff --git a/library/cpp/coroutine/engine/cont_poller.cpp b/library/cpp/coroutine/engine/cont_poller.cpp
index d801fe617f..76593d4e9b 100644
--- a/library/cpp/coroutine/engine/cont_poller.cpp
+++ b/library/cpp/coroutine/engine/cont_poller.cpp
@@ -1,70 +1,70 @@
-#include "cont_poller.h"
+#include "cont_poller.h"
#include "impl.h"
-namespace NCoro {
- namespace {
- template <class T>
- int DoExecuteEvent(T* event) noexcept {
- auto* cont = event->Cont();
-
- if (cont->Cancelled()) {
- return ECANCELED;
- }
-
- cont->Executor()->ScheduleIoWait(event);
+namespace NCoro {
+ namespace {
+ template <class T>
+ int DoExecuteEvent(T* event) noexcept {
+ auto* cont = event->Cont();
+
+ if (cont->Cancelled()) {
+ return ECANCELED;
+ }
+
+ cont->Executor()->ScheduleIoWait(event);
cont->Switch();
-
- if (cont->Cancelled()) {
- return ECANCELED;
- }
-
- return event->Status();
- }
+
+ if (cont->Cancelled()) {
+ return ECANCELED;
+ }
+
+ return event->Status();
+ }
+ }
+
+ void TContPollEvent::Wake() noexcept {
+ UnLink();
+ Cont()->ReSchedule();
}
- void TContPollEvent::Wake() noexcept {
- UnLink();
- Cont()->ReSchedule();
- }
-
-
- TInstant TEventWaitQueue::WakeTimedout(TInstant now) noexcept {
- TIoWait::TIterator it = IoWait_.Begin();
-
- if (it != IoWait_.End()) {
- if (it->DeadLine() > now) {
- return it->DeadLine();
- }
-
- do {
- (it++)->Wake(ETIMEDOUT);
- } while (it != IoWait_.End() && it->DeadLine() <= now);
- }
-
- return now;
- }
-
- void TEventWaitQueue::Register(NCoro::TContPollEvent* event) {
- IoWait_.Insert(event);
- event->Cont()->Unlink();
- }
-
- void TEventWaitQueue::Abort() noexcept {
- auto visitor = [](TContPollEvent& e) {
- e.Cont()->Cancel();
- };
- IoWait_.ForEach(visitor);
- }
+
+ TInstant TEventWaitQueue::WakeTimedout(TInstant now) noexcept {
+ TIoWait::TIterator it = IoWait_.Begin();
+
+ if (it != IoWait_.End()) {
+ if (it->DeadLine() > now) {
+ return it->DeadLine();
+ }
+
+ do {
+ (it++)->Wake(ETIMEDOUT);
+ } while (it != IoWait_.End() && it->DeadLine() <= now);
+ }
+
+ return now;
+ }
+
+ void TEventWaitQueue::Register(NCoro::TContPollEvent* event) {
+ IoWait_.Insert(event);
+ event->Cont()->Unlink();
+ }
+
+ void TEventWaitQueue::Abort() noexcept {
+ auto visitor = [](TContPollEvent& e) {
+ e.Cont()->Cancel();
+ };
+ IoWait_.ForEach(visitor);
+ }
+}
+
+void TFdEvent::RemoveFromIOWait() noexcept {
+ this->Cont()->Executor()->Poller()->Remove(this);
+}
+
+int ExecuteEvent(TFdEvent* event) noexcept {
+ return NCoro::DoExecuteEvent(event);
+}
+
+int ExecuteEvent(TTimerEvent* event) noexcept {
+ return NCoro::DoExecuteEvent(event);
}
-
-void TFdEvent::RemoveFromIOWait() noexcept {
- this->Cont()->Executor()->Poller()->Remove(this);
-}
-
-int ExecuteEvent(TFdEvent* event) noexcept {
- return NCoro::DoExecuteEvent(event);
-}
-
-int ExecuteEvent(TTimerEvent* event) noexcept {
- return NCoro::DoExecuteEvent(event);
-}