mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 17:48:54 +08:00
A little more clean-up of poll() error handling
This commit is contained in:
+4
-4
@@ -292,8 +292,6 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
|
|||||||
if (timeout == 0)
|
if (timeout == 0)
|
||||||
{
|
{
|
||||||
/* Poll returns immediately whether we have a poll event or not. */
|
/* Poll returns immediately whether we have a poll event or not. */
|
||||||
|
|
||||||
ret = sem_trywait(&sem);
|
|
||||||
}
|
}
|
||||||
else if (timeout > 0)
|
else if (timeout > 0)
|
||||||
{
|
{
|
||||||
@@ -326,7 +324,7 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
|
|||||||
abstime.tv_nsec -= NSEC_PER_SEC;
|
abstime.tv_nsec -= NSEC_PER_SEC;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = sem_timedwait(&sem, &abstime);
|
(void)sem_timedwait(&sem, &abstime);
|
||||||
irqrestore(flags);
|
irqrestore(flags);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -336,7 +334,9 @@ int poll(FAR struct pollfd *fds, nfds_t nfds, int timeout)
|
|||||||
poll_semtake(&sem);
|
poll_semtake(&sem);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Teardown the poll operation and get the count of events */
|
/* Teardown the poll operation and get the count of events. Zero will be
|
||||||
|
* returned in the case of a timeout.
|
||||||
|
*/
|
||||||
|
|
||||||
ret = poll_teardown(fds, nfds, &count);
|
ret = poll_teardown(fds, nfds, &count);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user