[lug] Returning from select

Jeffrey Siegal jbs at quiotix.com
Thu May 6 09:49:33 MDT 2004


Budyanto Himawan wrote:
> Hi,
> 
> Does anybody know what is the trigger that causes
> a select system call to return?
> 
> Say I'm doing a select on a read fd set with 50ms.
> I know if none of the fds in the set becomes readable
> after 50ms, select returns 0.
> 
> If I have 4 fds and 1 becomes readable.
> Would select immediately return or would it wait 
> for 50 ms and then return however number of fds
> readable at that time?

It does not wait, but it isn't guaranteed to return "immediately" 
either.  If the system is busy doing something else, it might not return 
as soon as the first fd becomes readable.  So there can be more than one 
fd readable when it does return.





More information about the LUG mailing list