Typo in <sys/select.h>?

Lavrentiev, Anton (NIH/NLM/NCBI) [C] lavr@ncbi.nlm.nih.gov
Wed Jul 6 14:17:34 GMT 2022


> Remember that 64 is MAXIMUM_WAIT_OBJECTS for WaitForMultipleObjects(),
> the underlying Win32 API used to implement select(), so using more than
> 64 hits some complex code to work around that...

True but the complex code (that involves thread spawning, if that's what you're referring to)
will only be activated if the actual number of objects inquired in those sets really exceed 64,
regardless of how big the sets passed to select() were...

So basically, FD_SETSIZE, as Corinna pointed out, just refers to how much "ballast" the arguments
carry -- with larger default FD_SETSIZE they can become unnecessarily heavy for just a few small
file descriptors.

And since FD_SETSIZE is allowed to be overridden by the user, the complex processing at some
point is unavoidable, since there is no limitation for how large FD_SETSIZE can be, and the sets
are densely populated.

Anton Lavrentiev
Contractor NIH/NLM/NCBI



More information about the Cygwin mailing list