| 61 | |
| 62 | private: |
| 63 | void DoExecute() override { |
| 64 | for (;;) { |
| 65 | TInstant tm = TInstant::Max(); |
| 66 | TTmResponse* resp = nullptr; |
| 67 | { |
| 68 | TGuard<TMutex> g(M_); |
| 69 | for (TIntrusiveList<TTmResponse>::TIterator it = R_.Begin(); it != R_.End(); ++it) { |
| 70 | if (it->Time < tm) { |
| 71 | tm = it->Time; |
| 72 | resp = &*it; |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | if (!E_.WaitD(tm)) { |
| 77 | resp->Request->SendReply(resp->Data); |
| 78 | TGuard<TMutex> g(M_); |
| 79 | delete resp; |
| 80 | } |
| 81 | if (Shutdown_) { |
| 82 | break; |
| 83 | } |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | private: |
| 88 | TAutoPtr<IThreadFactory::IThread> Thr_; |