mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 06:42:32 +08:00
poll: add poll_notify() api and call it in all drivers
Signed-off-by: wangbowen6 <wangbowen6@xiaomi.com>
This commit is contained in:
+1
-12
@@ -237,24 +237,13 @@ static struct tsc2007_dev_s *g_tsc2007list;
|
||||
|
||||
static void tsc2007_notify(FAR struct tsc2007_dev_s *priv)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* If there are threads waiting on poll() for TSC2007 data to become
|
||||
* available, then wake them up now. NOTE: we wake up all waiting
|
||||
* threads because we do not know that they are going to do. If they
|
||||
* all try to read the data, then some make end up blocking after all.
|
||||
*/
|
||||
|
||||
for (i = 0; i < CONFIG_TSC2007_NPOLLWAITERS; i++)
|
||||
{
|
||||
struct pollfd *fds = priv->fds[i];
|
||||
if (fds)
|
||||
{
|
||||
fds->revents |= POLLIN;
|
||||
iinfo("Report events: %08" PRIx32 "\n", fds->revents);
|
||||
nxsem_post(fds->sem);
|
||||
}
|
||||
}
|
||||
poll_notify(priv->fds, CONFIG_TSC2007_NPOLLWAITERS, POLLIN);
|
||||
|
||||
/* If there are threads waiting for read data, then signal one of them
|
||||
* that the read data is available.
|
||||
|
||||
Reference in New Issue
Block a user