Linux下 将文件描述符 设置为非阻塞状态
#include <unistd.h> #include <fcntl.h> void set() { int fd; //...文件操作... int flags = fcntl(fd,F_GETFL); flags |= O_NONBLOCK; fcntl(fd,F_SETFL,flags);//设置文件描述符为非阻塞 }