epollwait和epollctl都是线程安全的,但是当一个线程epollwait,而另一个线程用epollctl向同一个epoll_fd添加了一个监测fd后,epollwait有可能被改fd的读/写事件唤醒。
对于epollwait线程来说,可能得到的fd不是期待集合中的内容。这里需要注意一下。
参考:
http://stackoverflow.com/questions/5541054/how-to-correctly-read-data-when-using-epoll-wait
http://stackoverflow.com/questions/7058737/is-epoll-thread-safe