mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-24 02:29:23 +00:00
util: epoll_run: allow interrupting event polling
If an event handler returns a positive value, the event polling and handling loop is interrupted after all the pending events indicated by epoll_wait are processed. travis-ci: success for lazy-pages: add non-#PF events handling Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
82668f6734
commit
fcfdc19610
1 changed files with 6 additions and 0 deletions
|
|
@ -1231,6 +1231,7 @@ int epoll_add_rfd(int epfd, struct epoll_rfd *rfd)
|
|||
int epoll_run_rfds(int epollfd, struct epoll_event *evs, int nr_fds, int timeout)
|
||||
{
|
||||
int ret, i, nr_events;
|
||||
bool have_a_break = false;
|
||||
|
||||
while (1) {
|
||||
/* FIXME -- timeout should decrease over time... */
|
||||
|
|
@ -1251,7 +1252,12 @@ int epoll_run_rfds(int epollfd, struct epoll_event *evs, int nr_fds, int timeout
|
|||
ret = rfd->revent(rfd);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
if (ret > 0)
|
||||
have_a_break = true;
|
||||
}
|
||||
|
||||
if (have_a_break)
|
||||
return 1;
|
||||
}
|
||||
out:
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue