select() blocks

Patrick Schlangen patrick@schlangen.me
Mon Apr 23 11:18:00 GMT 2018


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