有两个功能在epoll的:
There are two functions in epoll:
他们是否线程安全当我用同样的epoll_fd?如果一个线程调用epoll_wait和其他人在同一时间打电话epoll_ctl会发生什么?
Are they thread-safe when I use the same epoll_fd? What will happen if one thread calls epoll_wait and others call epoll_ctl at the same time?
推荐答案这是线程安全的,但没有明确规定,很多文件 - 请参阅linux.derkeiler/Mailing-Lists/Kernel/2006-03/msg00084.html
It is thread-safe, but there isn't much documentation that explicitly states that - see linux.derkeiler/Mailing-Lists/Kernel/2006-03/msg00084.html
顺便说一句,你也可以有多个线程在等待一个epoll_fd,但在这种情况下,它可以得到一个有点棘手(例如,你可能想使用边沿触发(EPOLLET)或单稳模式(EPOLLONESHOT) - 见 linux.die/man/2/epoll_ctl )
BTW, you can also have multiple threads waiting on a single epoll_fd, but in that case it can get a bit tricky (i.e. you might want to use edge-triggered (EPOLLET) or oneshot mode (EPOLLONESHOT) - see linux.die/man/2/epoll_ctl)
更多推荐
是epoll的线程安全的?
发布评论