【发布时间】:2012-01-01 03:35:59
【问题描述】:
我今天将一些代码从 select() 移植到 kqueue(),我注意到 kevent() 似乎没有 select() 的“异常集”功能的模拟。
也就是说select()的function-signature是:
int select(int nfds, fd_set *restrict readfds, fd_set *restrict writefds, fd_set *restrict errorfds, struct timeval *restrict timeout);
...对于 kevent(),EVFILT_READ 对应于 (readfds),而 EVFILT_WRITE 对应于 (writefds),但我没有看到任何类似 EVFILT_ERROR 的东西对应于 (errorfds)。
真的只是不支持 kevent() 下的套接字错误条件,还是存在但以某种对我来说并不明显的方式实现?
【问题讨论】:
-
你需要什么errorfds?读取错误已通过读取事件报告,写入错误通过写入事件报告(通过导致读取或写入失败)。
标签: select error-handling kqueue