select() blocks

Levente leventelist@gmail.com
Mon Apr 23 12:35:00 GMT 2018


Yes, specifying 0 timeout makes select() to block forever. But this is
not the case; I reset it.

Anyways, thank you for both of your replies.

Levente

On Mon, Apr 23, 2018 at 1:18 PM, Patrick Schlangen <patrick@schlangen.me> wrote:
> Hi,
>
>> I have this select() call:
>>
>>            ret = select(serial->fd+1, &rfds, NULL, NULL, &tv_timeout);
>
> might be obvious, but be sure to always reset tv_timeout to your desired timeout befure running select().
> tv_timeout might be modified by select(), so when invoking it multiple times or in a loop, you need to reset tv_timeout every time.
> I once ran into a similar issue where I simply forgot to reset its value.
>
> Best Regards,
>
> Patrick
>
>



More information about the Libc-help mailing list