xiaoxiang781216 commented on code in PR #22511:
URL: https://github.com/apache/nuttx/pull/22511#discussion_r4729987930


##########
fs/vfs/fs_epoll.c:
##########
@@ -324,18 +359,30 @@ static int epoll_do_poll(FAR struct file *filep,
 
       spin_unlock_irqrestore(&eph->poll_lock, flags);
 
+      /* The set is ready while a member is ready, as for epoll_wait().  So
+       * check again the members that the last epoll_wait() reported: a
+       * member with data left notifies at once.
+       */
+
+      epoll_setup(eph);
+
       nxrmutex_lock(&eph->lock);
 
+      /* A node of the teardown list still has its poll set up: an event
+       * that came after the last epoll_wait() notified it.
+       */
+
       list_for_every_entry(&eph->setup, epn, epoll_node_t, node)
         {
-          /* Only check the notified fd */
-
-          if (!epn->notified)
+          if (epn->notified && epn->pfd.revents != 0)
             {
-              continue;
+              eventset |= POLLIN;

Review Comment:
   break



##########
fs/vfs/fs_epoll.c:
##########
@@ -324,18 +359,30 @@ static int epoll_do_poll(FAR struct file *filep,
 
       spin_unlock_irqrestore(&eph->poll_lock, flags);
 
+      /* The set is ready while a member is ready, as for epoll_wait().  So
+       * check again the members that the last epoll_wait() reported: a
+       * member with data left notifies at once.
+       */
+
+      epoll_setup(eph);
+
       nxrmutex_lock(&eph->lock);
 
+      /* A node of the teardown list still has its poll set up: an event
+       * that came after the last epoll_wait() notified it.
+       */
+
       list_for_every_entry(&eph->setup, epn, epoll_node_t, node)
         {
-          /* Only check the notified fd */
-
-          if (!epn->notified)
+          if (epn->notified && epn->pfd.revents != 0)
             {
-              continue;
+              eventset |= POLLIN;
             }
+        }
 
-          if (epn->pfd.revents != 0)
+      list_for_every_entry(&eph->teardown, epn, epoll_node_t, node)
+        {
+          if (epn->notified && epn->pfd.revents != 0)
             {
               eventset |= POLLIN;

Review Comment:
   break



##########
fs/vfs/fs_epoll.c:
##########
@@ -324,18 +359,30 @@ static int epoll_do_poll(FAR struct file *filep,
 
       spin_unlock_irqrestore(&eph->poll_lock, flags);
 
+      /* The set is ready while a member is ready, as for epoll_wait().  So
+       * check again the members that the last epoll_wait() reported: a
+       * member with data left notifies at once.
+       */
+
+      epoll_setup(eph);
+
       nxrmutex_lock(&eph->lock);
 
+      /* A node of the teardown list still has its poll set up: an event
+       * that came after the last epoll_wait() notified it.
+       */
+
       list_for_every_entry(&eph->setup, epn, epoll_node_t, node)
         {
-          /* Only check the notified fd */
-
-          if (!epn->notified)
+          if (epn->notified && epn->pfd.revents != 0)
             {
-              continue;
+              eventset |= POLLIN;
             }
+        }
 
-          if (epn->pfd.revents != 0)
+      list_for_every_entry(&eph->teardown, epn, epoll_node_t, node)

Review Comment:
   don't need loop if hit line 379



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to