| 204 | } |
| 205 | |
| 206 | void TContExecutor::Poll(TInstant deadline) { |
| 207 | Poller_.Wait(PollerEvents_, deadline); |
| 208 | LastPoll_ = Now(); |
| 209 | |
| 210 | // Waking a coroutine puts it into ReadyNext_ list |
| 211 | for (auto event : PollerEvents_) { |
| 212 | auto* lst = (NCoro::TPollEventList*)event.Data; |
| 213 | const int status = event.Status; |
| 214 | |
| 215 | if (status) { |
| 216 | for (auto it = lst->Begin(); it != lst->End();) { |
| 217 | (it++)->OnPollEvent(status); |
| 218 | } |
| 219 | } else { |
| 220 | const ui16 filter = event.Filter; |
| 221 | |
| 222 | for (auto it = lst->Begin(); it != lst->End();) { |
| 223 | if (it->What() & filter) { |
| 224 | (it++)->OnPollEvent(0); |
| 225 | } else { |
| 226 | ++it; |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | void TContExecutor::Abort() noexcept { |
| 234 | WaitQueue_.Abort(); |