This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: select() blocks


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
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]