| 1233 | } |
| 1234 | |
| 1235 | ssize_t PollD(struct pollfd fds[], nfds_t nfds, const TInstant& deadLine) noexcept { |
| 1236 | TInstant now = TInstant::Now(); |
| 1237 | |
| 1238 | do { |
| 1239 | const TDuration toWait = PollStep(deadLine, now); |
| 1240 | const int res = poll(fds, nfds, MicroToMilli(toWait.MicroSeconds())); |
| 1241 | |
| 1242 | if (res > 0) { |
| 1243 | return res; |
| 1244 | } |
| 1245 | |
| 1246 | if (res < 0) { |
| 1247 | const int err = LastSystemError(); |
| 1248 | |
| 1249 | if (err != ETIMEDOUT && err != EINTR) { |
| 1250 | return -err; |
| 1251 | } |
| 1252 | } |
| 1253 | } while ((now = TInstant::Now()) < deadLine); |
| 1254 | |
| 1255 | return -ETIMEDOUT; |
| 1256 | } |
| 1257 | |
| 1258 | void ShutDown(SOCKET s, int mode) { |
| 1259 | if (shutdown(s, mode)) { |
no test coverage detected