epoll需要注意的

http://man7.org/linux/man-pages/man7/epoll.7.html

FAQ

2. Can two epoll instances wait for the same file descriptor?  If so, are events reported to both epoll file descriptors?

一个文件描述符能不能被两个epoll实例监测?

Yes, and events would be reported to both.  However, careful programming may be needed to do this correctly.

可以,并且这两个epoll都会得到事件通知。

3.  Is the epoll file descriptor itself poll/epoll/selectable?

Yes.  If an epoll file descriptor has events waiting, then it will indicate as being readable.

If multiple threads (or processes, if child processes have inherited
the epoll file descriptor across fork(2)) are blocked in
epoll_wait(2) waiting on the same the same epoll file descriptor and
a file descriptor in the interest list that is marked for edge-
triggered (EPOLLET) notification becomes ready, just one of the
threads (or processes) is awoken from epoll_wait(2).  This provides a
useful optimization for avoiding "thundering herd" wake-ups in some
scenarios.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值