開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
c++11
問題(Question):
當pipe在其他thread瞬間大量寫入時,
epoll_wait只會被喚醒一次,
如果沒一次把data全部讀完就會卡在epoll_wait
除非改成epoll_wait(efd, events, MAXEVENTS, 1000);
預期的正確結果(Expected Output):
每輪只從各fd讀取一部份資料,
要如何得知還有data未讀取,
並在下一輪繼續讀取剩下的資料呢?
程式碼(Code):(請善用置底文網頁, 記得排版)
以下是簡化後示意的程式碼:
http://codepad.org/8af9AZkm
g++ -o main.o main.cpp