mechevere / picocom

Automatically exported from code.google.com/p/picocom
GNU General Public License v2.0
0 stars 0 forks source link

Optimise call to select(2) #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
select(2) executes in linear time (O(n)) to its first argument. Since we know
for sure that tty_fd is going to be the maximum fd we need to check, pass that
rather than FD_SETSIZE so we only need to scan over the first few file
descriptors rather than all 1024 (or however many FD_SETSIZE is defined to).

Original issue reported on code.google.com by lwith...@gmail.com on 12 Oct 2011 at 9:56

Attachments:

GoogleCodeExporter commented 9 years ago
As my colleague pointed out, select(2)'s first argument is in fact the highest 
file descriptor to check plus one, not just the highest file descriptor, so the 
patch should read select(tty_fd + 1, ...).

Original comment by lwith...@gmail.com on 13 Oct 2011 at 12:34

GoogleCodeExporter commented 9 years ago
Fixed in r24

Original comment by nick.pat...@gmail.com on 21 Feb 2012 at 6:31