Catch EBADF in async
This commit is contained in:
@ -256,9 +256,14 @@ void async_thread(void) {
|
|||||||
evt_listen_t *evt = events[i].data.ptr;
|
evt_listen_t *evt = events[i].data.ptr;
|
||||||
if (async_exec(evt, async_e2a(events[i].events)) == 0) {
|
if (async_exec(evt, async_e2a(events[i].events)) == 0) {
|
||||||
if (epoll_ctl(epoll_fd, EPOLL_CTL_DEL, evt->fd, NULL) == -1) {
|
if (epoll_ctl(epoll_fd, EPOLL_CTL_DEL, evt->fd, NULL) == -1) {
|
||||||
|
if (errno == EBADF) {
|
||||||
|
// already closed fd, do not die
|
||||||
|
errno = 0;
|
||||||
|
} else {
|
||||||
critical("Unable to remove file descriptor from epoll instance");
|
critical("Unable to remove file descriptor from epoll instance");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
local = list_delete(local, &evt);
|
local = list_delete(local, &evt);
|
||||||
if (local == NULL) {
|
if (local == NULL) {
|
||||||
|
Reference in New Issue
Block a user