Re: select()/pselect() function

2020-11-20 Thread Gregory Nutt
From POSIX: "If the timeout interval expires without the specified condition being true for any of the specified file descriptors, the objects pointed to by the readfds, writefds, and errorfds arguments shall have all bits set to 0." If your select() timeouts on first loop iteration for any

Re: select()/pselect() function

2020-11-20 Thread Daniel Pereira Carvalho
ut forever as you give it back all-zeroes descriptor set to > monitor. > > Best Regards, >Juha Niskanen > > > > From: Daniel Pereira Carvalho > Sent: Friday, November 20, 2020 7:26 PM > To: dev@nuttx.apache.org > Subject: Re

Re: select()/pselect() function

2020-11-20 Thread Juha Niskanen (Haltian)
p iteration for any reason, then it will timeout forever as you give it back all-zeroes descriptor set to monitor. Best Regards, Juha Niskanen From: Daniel Pereira Carvalho Sent: Friday, November 20, 2020 7:26 PM To: dev@nuttx.apache.org Subject: Re: select()

Re: select()/pselect() function

2020-11-20 Thread Daniel Pereira Carvalho
I will try pool() and see if the problem persists. Thanks Daniel Pereira de Carvalho Em sex., 20 de nov. de 2020 às 14:18, Gregory Nutt escreveu: > Okay, I got that wrong. I seldom used select(), it is just an > additional layer on top of poll() which is much more efficient. > > On 11/20/202

Re: select()/pselect() function

2020-11-20 Thread Gregory Nutt
Okay, I got that wrong.  I seldom used select(), it is just an additional layer on top of poll() which is much more efficient. On 11/20/2020 11:13 AM, Daniel Pereira Carvalho wrote: Hi Greg, Thanks for the answer. I don't understand why I should use 1 instead of fs + 1. The documentation says

Re: select()/pselect() function

2020-11-20 Thread Daniel Pereira Carvalho
Hi Greg, Thanks for the answer. I don't understand why I should use 1 instead of fs + 1. The documentation says "nfds This argument should be set to the highest-numbered file descriptor in any of the three sets, plus 1. " In the portserial.c nfds was set to fd + 1 Daniel Pereira de Carvalho E

Re: select()/pselect() function

2020-11-20 Thread Gregory Nutt
fd = open("/dev/ttyS1", O_RDWR | O_NOCTTY); ... s_rc = select(fd + 1, &rset, NULL, NULL, &tv); The first argument should be 1, not fd + 1