Don't throw an exception if epoll_wait is interrupted
This commit is contained in:
parent
252a4788b5
commit
697573cbaf
@ -39,7 +39,8 @@ namespace fr
|
|||||||
*
|
*
|
||||||
* @throws An std::exception on failure
|
* @throws An std::exception on failure
|
||||||
* @param timeout The maximum time in milliseconds to wait for. Default/-1 for no timeout.
|
* @param timeout The maximum time in milliseconds to wait for. Default/-1 for no timeout.
|
||||||
* @return A list of sockets which either are ready, or have disconnected.
|
* @return A list of sockets which either are ready, or have disconnected. This can be empty
|
||||||
|
* if there is a timeout, or the wait is interrupted.
|
||||||
*/
|
*/
|
||||||
std::vector<std::pair<std::shared_ptr<fr::SocketDescriptor>, void*>> wait(std::chrono::milliseconds timeout = std::chrono::milliseconds(-1));
|
std::vector<std::pair<std::shared_ptr<fr::SocketDescriptor>, void*>> wait(std::chrono::milliseconds timeout = std::chrono::milliseconds(-1));
|
||||||
|
|
||||||
|
|||||||
@ -57,6 +57,10 @@ namespace fr
|
|||||||
int event_count = epoll_wait(epoll_fd, events, 100, timeout.count());
|
int event_count = epoll_wait(epoll_fd, events, 100, timeout.count());
|
||||||
if(event_count < 0)
|
if(event_count < 0)
|
||||||
{
|
{
|
||||||
|
if(errno == EINTR)
|
||||||
|
{
|
||||||
|
return {};
|
||||||
|
}
|
||||||
throw std::runtime_error("epoll_wait returned: " + std::to_string(errno));
|
throw std::runtime_error("epoll_wait returned: " + std::to_string(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user