mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
poll: add poll_notify() api and call it in all drivers
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
This commit is contained in:
parent
74842880f9
commit
344c8be049
83 changed files with 289 additions and 1441 deletions
|
|
@ -49,7 +49,6 @@
|
|||
static void nxterm_pollnotify(FAR struct nxterm_state_s *priv,
|
||||
pollevent_t eventset)
|
||||
{
|
||||
FAR struct pollfd *fds;
|
||||
irqstate_t flags;
|
||||
int i;
|
||||
|
||||
|
|
@ -58,16 +57,7 @@ static void nxterm_pollnotify(FAR struct nxterm_state_s *priv,
|
|||
for (i = 0; i < CONFIG_NXTERM_NPOLLWAITERS; i++)
|
||||
{
|
||||
flags = enter_critical_section();
|
||||
fds = priv->fds[i];
|
||||
if (fds)
|
||||
{
|
||||
fds->revents |= (fds->events & eventset);
|
||||
if (fds->revents != 0)
|
||||
{
|
||||
nxsem_post(fds->sem);
|
||||
}
|
||||
}
|
||||
|
||||
poll_notify(&priv->fds[i], 1, eventset);
|
||||
leave_critical_section(flags);
|
||||
}
|
||||
}
|
||||
|
|
@ -304,10 +294,7 @@ int nxterm_poll(FAR struct file *filep, FAR struct pollfd *fds, bool setup)
|
|||
eventset |= POLLIN;
|
||||
}
|
||||
|
||||
if (eventset)
|
||||
{
|
||||
nxterm_pollnotify(priv, eventset);
|
||||
}
|
||||
nxterm_pollnotify(priv, eventset);
|
||||
}
|
||||
else if (fds->priv)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue