pselect()
来源:互联网 发布:win7网络共享设置软件 编辑:程序博客网 时间:2024/05/22 15:17
很久以来,同事写的一个模块,与串口收发数据的时候,SELECT()函数等待的时间长点,就会被模块里设置的时钟信号打断,最近看到了一个新的函数pselect(),研究了一把,收获不小!!
现在发现,SELECT()函数等待的这段时间内不想被别的信号打断的方法有两
其一:
用pselect()函数
#include
#include
#include
#include
#include
#include
#define BUFFSIZE 80
void sig_int(int signo);
void err_sys(const char *p_error);
void sig_alrm(int signo)
{
}
int
main(int argc, char **argv)
{
}
void
sig_int(int signo)
{
}
void
err_sys(const char *p_error)
{
}
上段代码如果没有CTRL+C送上一个SIGINT信号,将永远阻塞在与用户的交互上,ALARM产生的SIGALRM信号永远打断不了PSELECT,ALARM信号被成功屏蔽
方法2:sigprocmask()
#include
#include
#include
#include
#include
#include
#define BUFFSIZE 80
void sig_int(int signo);
void err_sys(const char *p_error);
void sig_alrm(int signo)
{
}
int
main(int argc, char **argv)
{
}
void
sig_int(int signo)
{
}
void
err_sys(const char *p_error)
{
}
同样,上段代码如果没有CTRL+C送上一个SIGINT信号,将永远阻塞在与用户的交互上,ALARM产生的SIGALRM信号永远打断不了SELECT,ALARM信号被成功屏蔽
- pselect
- pselect()
- pselect
- pselect()
- select pselect poll
- select()与pselect()
- select() vs pselect()
- select和pselect
- select和pselect区别
- select,pselect,poll函数
- io复用select pselect
- 关于select , pselect , poll
- I/O复用:pselect
- linux select pselect poll 异同
- select 和pselect的区别
- select pselect poll ppoll epoll
- select pselect相同与区别
- pselect(2) - Linux man page
- key
- socket通讯实例 (objective-c)
- Spring3MVC:tiles plugin Tutorial with Example in Eclipse
- Method not allowed
- Android图片处理(Matrix,ColorMatrix)
- pselect()
- 天涯运维:如何给企业选择适合的开源技术构架
- 'HDEVNOTIFY' : missing storage-class or type specifiers
- IOS客户端接入Facebook,SSO授权
- java 计算两个时间之间的间隔
- 不用安装oracle客户端也可以用plsql连接远程oracle
- 流年,经不起怀念
- 搭建GlusterFS集群-Distributed Replicated Volumes
- 多文件上传--3 (uploadImage.swf)