Interrupting epoll_wait with a non-IO event, no signals

后端 未结 2 1110
盖世英雄少女心
盖世英雄少女心 2020-12-29 13:54

Current scenario is epoll_wait over a couple of fds and a queue of possible incoming messages, I\'d like the loop below epoll_wait to be executed on IO event or on new messa

2条回答
  •  温柔的废话
    2020-12-29 14:32

    You can use an eventfd which is effectively the same thing as the self-pipe trick except with fewer file descriptors and less boilerplate (glibc has convenience eventfd_read/write functions for instance).

提交回复
热议问题