linux c++(IO & 第二篇 非阻塞IO)

非阻塞IO

方法一
int fd=open("/dev/tty",O_RDWR|O_NONBLOCK); 
方法二
//fcntl()函数,设置非阻塞
int flags = fcntl(fd,F_GETFL);
flags |= O_NONBLOCK;
fcntl(fd,F_SETFL,flags);

posted on 2021-05-03 13:00  lodger47  阅读(247)  评论(0)    收藏  举报

导航