Why does poll keep returning although there is no input?

后端 未结 3 1105
南旧
南旧 2020-12-18 07:12

I wrote a small test program to figure out how to talk to poll. I created three files testa,testb,testc and wrote the string hel

3条回答
  •  攒了一身酷
    2020-12-18 07:44

    Once you reach the end of a file, it remains readable so that poll will return immediately, and calling read will immediately return zero. You need to handle this condition, perhaps by closing it and removing it from the set of polls, where you're currently printing Strange.

提交回复
热议问题