Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: select/poll bug?



On Sat, Aug 02, 2008 at 11:25:17AM -0400, Christos Zoulas wrote:
> The select family of system calls is generally inferior to poll because:
> 
> 1. Expensive because you need do operations on bitmasks [ffs/shifts].
> 2. Expensive because you need to reset the masks before each call.
> 3. Non portable behavior for >= 256 fd's. All systems need source
>    recompilation; some older systems need kernel recompilation.
> 4. Non-portable behavior with respect to ERESTART.
> 5. Non-portable behavior when running out of resources. The only
>    way to fix this is using non-blocking-io which is a bit of a pain.
> 6. Non-portable behavior with respect to "struct timeval *timeout".
>    This is non-const, and it was originally intended to return
>    the time left. Most implementations did not change "timeout", but  
>    one or two did, so it is always good to re-initialize "timeout".  
> 7. Can only report 3 types of events, read/write/except.

OTOH, poll on Mac OS X does NOT work properly on device file
descriptors, which means that any code that wants to work on Mac OS X
usually has checks in configure scripts for Darwin, and
wrappers/transform functions around poll, reimplementing it in terms
of select for that one platform.

Regards,
Al


Home | Main Index | Thread Index | Old Index