非阻塞 I/O 经常使用 poll(System V)、select(BSD Unix)、 epoll(linux2.5.45开始)系统调用。
select系统调用
select()的调用形式为: #include <sys/select.h>
#include <sys/time.h>
int select(int maxfd, /*要被检测的比特数,待检测的最大文件描述符大1*/
fd_set *readfds, /*被读监控的文件描述符集*/
fd_set *writefds, /*被读监控的文件描述符集*/
fd_set *exceptfds, /*被例外条件监控......
阅读全文