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