Why does select.select() work with disk files but not epoll()?

后端 未结 1 644
别跟我提以往
别跟我提以往 2020-12-18 01:09

The following code essentially cats a file with select.select():

f = open(\'node.py\')
fd = f.fileno()
while True:
    r, w, e = select.select([fd], [], [])
         


        
相关标签:
1条回答
  • 2020-12-18 01:51

    select allows filedescriptors pointing to regular files to be monitored, however it will always report a file as readable/writable (i.e. it's somewhat useless, as it doesn't tell you whether a read/write would actually block).

    epoll just disallows monitoring of regular files, as it has no mechanism (on linux at least) available to tell whether reading/writing a regular file would block

    0 讨论(0)
提交回复
热议问题