lkml.org 
[lkml]   [2001]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: select() - Linux vs. BSD
Date

> I would have said just the opposite. That if it you have a large
> number of
> handles you're waiting on, and you have to go back through and
> set the bits
> everytime you timeout that you would incur a larger overhead. From the
> perspective of my application, it would have been more efficient
> to not zero
> them (I was waiting on a number of serial channels, and the
> timeout was used
> to periodically pump more data to the serial channel. When I
> received data,
> I buffered it, and another thread took care of processing it).

The usual implementation is you have a 'permanent' fd_set and a 'temporary'
fd_set. Before each call to select, you memcpy the permanent fd_set into the
temporary and pass the temporary to select. If you wish to stop selecting
for read or write on a given socket, you remove it from the appropriate
permanent set. This way you don't have to twiddle too many bits.

DS

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:54    [W:0.043 / U:0.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site