drivers/pipes: fix write busy loop because POLLOUT always ready.
the size of pipes buffer +1 as compensate the full indicator Signed-off-by: dongjiuzhu1 <dongjiuzhu1@xiaomi.com>
This commit is contained in:
parent
004853d6d1
commit
74e032e924
1 changed files with 2 additions and 2 deletions
|
|
@ -441,7 +441,7 @@ ssize_t pipecommon_read(FAR struct file *filep, FAR char *buffer, size_t len)
|
|||
* FIFO when buffer can accept more than d_polloutthrd bytes.
|
||||
*/
|
||||
|
||||
if (pipecommon_bufferused(dev) < (dev->d_bufsize - dev->d_polloutthrd))
|
||||
if (pipecommon_bufferused(dev) < (dev->d_bufsize - 1 - dev->d_polloutthrd))
|
||||
{
|
||||
poll_notify(dev->d_fds, CONFIG_DEV_PIPE_NPOLLWAITERS, POLLOUT);
|
||||
}
|
||||
|
|
@ -699,7 +699,7 @@ int pipecommon_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||
|
||||
eventset = 0;
|
||||
if ((filep->f_oflags & O_WROK) &&
|
||||
nbytes < (dev->d_bufsize - dev->d_polloutthrd))
|
||||
nbytes < (dev->d_bufsize - 1 - dev->d_polloutthrd))
|
||||
{
|
||||
eventset |= POLLOUT;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue