Question on RTEMS select()

Gene Smith gds at chartertn.net
Sat Nov 15 20:59:34 UTC 2008


I have been integrating some 3rd party code that uses select() on a 
small set of sockets. The code was giving it a small but non-zero time 
value to wait. I tried to set the time value (tv) to zero so that 
select() would just do a poll and not block/delay. However, unless a 
socket is ready at the time of call, it appears that RTEMS still blocks 
for 1 tick even if tv values are zero (calls rtems_event_receive() at 
the bottom of the loop with RTEMS_WAIT option set and timo 1).

Seems like if the tv time values are zero it should just call selscan() 
one time and get out. It either finds ready sockets or it doesn't -- no 
need to delay and try again.

The select man page and Steven UNP say that if the time value pointer is 
NULL it will wait as long as it takes (RTEMS does this OK). But if the 
time value itself is set to zero then select() will just "poll" for a 
ready socket and not wait (RTEMS might still wait and block for 1 tick).

Or, I could be confused??

-gene










More information about the users mailing list