Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
成功时,epoll_wait(2) 返回为请求的 I/O 准备好的文件描述符的数量,如果在请求的超时毫秒内没有文件描述符准备好,则返回零。发生错误时,epoll_wait(2) 返回 -1 并正确设置 errno。
假设 epoll 是 ET 触发的,epoll_wait对于 N 个连接的套接字会通知进程 N 次还是只通知一次?
epoll_wait
假设 epoll 是 ET 触发的,epoll_wait 会通知进程 N 次连接 N 个套接字还是 > 只通知一次?
对于每个具有您要求的 IO 事件的套接字,您将收到一个通知。当然,epoll_wait 每次调用可以传递多个通知。
如果 N 个客户端同时连接并且您接受所有这些,则会发生进一步的通知。如果 N 个客户端连接并且您接受 N-1,则在您消耗所有事件之前不会发生通知。