http://zhidao.baidu.com/link?url=UVTXeK4ncKmnwatGUW2deMFylNYBuur-zHmK3w53NXNRpgPbhld2WdkMD766nKl_6HjtW3t0tyB5kzFaQDHxha
On Linux, select() modifies timeout to reflect the amount of time not slept; most other implementations do not do this. (POSIX.1-2001 permits either behavior.)
This causes problems both when Linux code which reads timeout is ported to other operating systems, and when code is ported to Linux that reuses a struct timeval
for multiple select()s in a loop without reinitializing it. Consider timeout to be undefined after select() returns.
linux在select调用之后会修改timeout值为无sleep的时间。所以第一次select是sleep了timeout设定的时间,然后timeout就被修改为0了(因为全部时间都在sleep,无sleep为0)。
在循环内调用第二次开始就有问题。