xiaoxiang781216 commented on code in PR #10706: URL: https://github.com/apache/nuttx/pull/10706#discussion_r1376318537
########## fs/vfs/fs_epoll.c: ########## @@ -323,12 +368,47 @@ static int epoll_teardown(FAR epoll_head_t *eph, FAR struct epoll_event *evs, list_add_tail(&eph->teardown, &epn->node); } } + else + { + list_add_tail(&eph->teardown, &epn->node); + } } nxmutex_unlock(&eph->lock); return i; } +/**************************************************************************** + * Name: epoll_default_cb + * + * Description: + * The default epoll callback function, this function do the final step of + * poll notification. + * + * Input Parameters: + * fds - The fds + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void epoll_default_cb(FAR struct pollfd *fds) +{ + FAR epoll_node_t *epn = fds->arg; + int semcount = 0; + + epn->notified = true; + if (fds->revents != 0) + { + nxsem_get_value(&epn->eph->sem, &semcount); Review Comment: should we post until semcount == 1? ########## fs/vfs/fs_epoll.c: ########## @@ -658,23 +744,29 @@ int epoll_pwait(int epfd, FAR struct epoll_event *evs, #endif ret = nxsem_tickwait(&eph->sem, ticks); - if (ret == -ETIMEDOUT) - { - ret = OK; - } } else { ret = nxsem_wait(&eph->sem); } nxsig_procmask(SIG_SETMASK, &oldsigmask, NULL); - if (ret < 0) + if (ret < 0 && ret != -ETIMEDOUT) { goto err; } + else /* ret >= 0 or ret == -ETIMEDOUT */ + { + int num = epoll_teardown(eph, evs, maxevents); + if (num == 0 && timeout != 0 && ret != -ETIMEDOUT) Review Comment: make the similar change ########## fs/vfs/fs_epoll.c: ########## @@ -730,22 +823,28 @@ int epoll_wait(int epfd, FAR struct epoll_event *evs, #endif ret = nxsem_tickwait(&eph->sem, ticks); - if (ret == -ETIMEDOUT) - { - ret = OK; - } } else { ret = nxsem_wait(&eph->sem); } - if (ret < 0) + if (ret < 0 && ret != -ETIMEDOUT) { goto err; } + else /* ret >= 0 or ret == -ETIMEDOUT */ + { + int num = epoll_teardown(eph, evs, maxevents); + if (num == 0 && timeout != 0 && ret != -ETIMEDOUT) Review Comment: but let's change line 810 to `ret = -ETIMEOUT;`: ```suggestion if (num == 0 && ret >= 0) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org