This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: select() blocks
- From: "Patrick Schlangen" <patrick at schlangen dot me>
- To: "Levente" <leventelist at gmail dot com>
- Cc: <libc-help at sourceware dot org>
- Date: Mon, 23 Apr 2018 13:18:40 +0200
- Subject: Re: select() blocks
- References: <CACwWb3D_Oag-WNB9mu6WxrEKB0GFV1tA-2xthmVyk_Rwt0PXxg@mail.gmail.com>
- Reply-to: "Patrick Schlangen" <patrick at schlangen dot me>
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