gpt4 book ai didi

c - 是否有必要在关闭 epoll 实例本身之前删除兴趣列表中的所有文件描述符?

转载 作者:行者123 更新时间:2023-12-05 04:38:41 25 4
gpt4 key购买 nike

前提是:

  • 我已经通过 epoll_create 创建了一个 epoll 实例 epfd,并通过 EPOLL_CTL_ADD 注册了许多常规文件描述符。
  • 我想通过close(epfd)
  • 关闭epoll实例

manual page没有说我是否必须在 close(epfd) 之前 EPOLL_CTL_DEL 所有文件描述符。

所以,我的问题是:

是否有必要在关闭 epoll 实例本身之前删除兴趣列表中的所有文件描述符?

最佳答案

不,没有必要手动删除它们。

来自epoll_create(2) manpage (强调)

When all file descriptors referring to an epoll instance have been closed, the kernel destroys the instance and releases the associated resources for reuse.

关于c - 是否有必要在关闭 epoll 实例本身之前删除兴趣列表中的所有文件描述符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70552144/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com