| 263 | } |
| 264 | |
| 265 | Result Select(Selector* selector, int32_t timeout) |
| 266 | { |
| 267 | if (timeout > 0) |
| 268 | { |
| 269 | timeout = timeout / 1000; |
| 270 | } |
| 271 | int r = dmFileDescriptor::Wait(&selector->m_Poller, (timeout < 0) ? 0 : timeout); |
| 272 | if (r < 0) |
| 273 | { |
| 274 | return NativeToResult(__FUNCTION__, __LINE__, DM_SOCKET_ERRNO); |
| 275 | } |
| 276 | else if(timeout > 0 && r == 0) |
| 277 | { |
| 278 | return RESULT_WOULDBLOCK; |
| 279 | } |
| 280 | else |
| 281 | { |
| 282 | return RESULT_OK; |
| 283 | } |
| 284 | } |
| 285 | } |