From d3a398281c6fd1d3672036cb2d63f842d2cb28c5 Mon Sep 17 00:00:00 2001
From: Anton Samokhvalov <pg83@yandex.ru>
Date: Thu, 10 Feb 2022 16:45:17 +0300
Subject: Restoring authorship annotation for Anton Samokhvalov
 <pg83@yandex.ru>. Commit 2 of 2.

---
 library/cpp/coroutine/engine/cont_poller.h | 112 ++++++++++++++---------------
 1 file changed, 56 insertions(+), 56 deletions(-)

(limited to 'library/cpp/coroutine/engine/cont_poller.h')

diff --git a/library/cpp/coroutine/engine/cont_poller.h b/library/cpp/coroutine/engine/cont_poller.h
index e6b23149c3..b638b2df1a 100644
--- a/library/cpp/coroutine/engine/cont_poller.h
+++ b/library/cpp/coroutine/engine/cont_poller.h
@@ -1,27 +1,27 @@
 #pragma once
- 
-#include "poller.h" 
+
+#include "poller.h"
 #include "sockmap.h"
- 
+
 #include <library/cpp/containers/intrusive_rb_tree/rb_tree.h>
 
 #include <util/datetime/base.h>
 #include <util/memory/pool.h>
-#include <util/memory/smallobj.h> 
+#include <util/memory/smallobj.h>
 #include <util/network/init.h>
- 
+
 #include <cerrno>
 
 
-class TCont; 
-class TContExecutor; 
+class TCont;
+class TContExecutor;
 class TFdEvent;
- 
+
 namespace NCoro {
 
     class IPollEvent;
- 
- 
+
+
     struct TContPollEventCompare {
         template <class T>
         static inline bool Compare(const T& l, const T& r) noexcept {
@@ -29,74 +29,74 @@ namespace NCoro {
         }
     };
 
- 
+
     class TContPollEvent : public TRbTreeItem<TContPollEvent, TContPollEventCompare> {
     public:
         TContPollEvent(TCont* cont, TInstant deadLine) noexcept
             : Cont_(cont)
             , DeadLine_(deadLine)
         {}
- 
+
         static bool Compare(const TContPollEvent& l, const TContPollEvent& r) noexcept {
             return l.DeadLine() < r.DeadLine() || (l.DeadLine() == r.DeadLine() && &l < &r);
         }
- 
+
         int Status() const noexcept {
             return Status_;
         }
- 
+
         void SetStatus(int status) noexcept {
             Status_ = status;
         }
- 
+
         TCont* Cont() noexcept {
             return Cont_;
         }
- 
+
         TInstant DeadLine() const noexcept {
             return DeadLine_;
         }
- 
+
         void Wake(int status) noexcept {
             SetStatus(status);
             Wake();
-        } 
- 
+        }
+
     private:
         void Wake() noexcept;
- 
+
     private:
         TCont* Cont_;
         TInstant DeadLine_;
         int Status_ = EINPROGRESS;
-    }; 
- 
- 
+    };
+
+
     class IPollEvent: public TIntrusiveListItem<IPollEvent> {
     public:
         IPollEvent(SOCKET fd, ui16 what) noexcept
             : Fd_(fd)
             , What_(what)
         {}
- 
+
         virtual ~IPollEvent() {}
- 
+
         SOCKET Fd() const noexcept {
             return Fd_;
         }
- 
+
         int What() const noexcept {
             return What_;
         }
- 
+
         virtual void OnPollEvent(int status) noexcept = 0;
- 
+
     private:
         SOCKET Fd_;
         ui16 What_;
     };
- 
- 
+
+
     template <class T>
     class TBigArray {
         struct TValue: public T, public TObjectFromPool<TValue> {
@@ -124,27 +124,27 @@ namespace NCoro {
 
 
     using TPollEventList = TIntrusiveList<IPollEvent>;
- 
+
     class TContPoller {
     public:
         using TEvent = IPollerFace::TEvent;
         using TEvents = IPollerFace::TEvents;
- 
+
         TContPoller()
             : P_(IPollerFace::Default())
         {
         }
- 
+
         explicit TContPoller(THolder<IPollerFace> poller)
             : P_(std::move(poller))
         {}
- 
+
         void Schedule(IPollEvent* event) {
             auto* lst = Lists_.Get(event->Fd());
             const ui16 oldFlags = Flags(*lst);
             lst->PushFront(event);
             ui16 newFlags = Flags(*lst);
- 
+
             if (newFlags != oldFlags) {
                 if (oldFlags) {
                     newFlags |= CONT_POLL_MODIFY;
@@ -152,14 +152,14 @@ namespace NCoro {
 
                 P_->Set(lst, event->Fd(), newFlags);
             }
-        } 
- 
+        }
+
         void Remove(IPollEvent* event) noexcept {
             auto* lst = Lists_.Get(event->Fd());
             const ui16 oldFlags = Flags(*lst);
             event->Unlink();
             ui16 newFlags = Flags(*lst);
- 
+
             if (newFlags != oldFlags) {
                 if (newFlags) {
                     newFlags |= CONT_POLL_MODIFY;
@@ -167,13 +167,13 @@ namespace NCoro {
 
                 P_->Set(lst, event->Fd(), newFlags);
             }
-        } 
- 
+        }
+
         void Wait(TEvents& events, TInstant deadLine) {
             events.clear();
             P_->Wait(events, deadLine);
-        } 
- 
+        }
+
         EContPoller PollEngine() const {
             return P_->PollEngine();
         }
@@ -182,14 +182,14 @@ namespace NCoro {
             ui16 ret = 0;
             for (auto&& item : lst) {
                 ret |= item.What();
-            } 
+            }
             return ret;
-        } 
- 
+        }
+
     private:
         TBigArray<TPollEventList> Lists_;
         THolder<IPollerFace> P_;
-    }; 
+    };
 
 
     class TEventWaitQueue {
@@ -210,12 +210,12 @@ namespace NCoro {
         TIoWait IoWait_;
     };
 }
- 
+
 class TFdEvent final:
     public NCoro::TContPollEvent,
     public NCoro::IPollEvent
 {
-public: 
+public:
     TFdEvent(TCont* cont, SOCKET fd, ui16 what, TInstant deadLine) noexcept
         : TContPollEvent(cont, deadLine)
         , IPollEvent(fd, what)
@@ -223,22 +223,22 @@ public:
 
     ~TFdEvent() {
         RemoveFromIOWait();
-    } 
- 
+    }
+
     void RemoveFromIOWait() noexcept;
- 
+
     void OnPollEvent(int status) noexcept override {
         Wake(status);
-    } 
-}; 
- 
+    }
+};
+
 
 class TTimerEvent: public NCoro::TContPollEvent {
-public: 
+public:
     TTimerEvent(TCont* cont, TInstant deadLine) noexcept
         : TContPollEvent(cont, deadLine)
     {}
-}; 
+};
 
 int ExecuteEvent(TFdEvent* event) noexcept;
 
-- 
cgit v1.2.3