在线笔记
全部博文(596)
分类: LINUX
2013-01-29 10:06:32
int select(int nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, struct timeval *timeout);
timeout is an upper bound on the amount of time elapsed before select() returns. If
both fields of the timeval stucture are zero, then select() returns immediately. (Thisis useful for polling.) If timeout is NULL (no timeout), select() can block indefinitely.
select阻塞超过timeout时间,就返回0。
如果timeout是0,则select直接返回0;
如果timeout是NULL,则select会阻塞,时间不确定。