From 4bed9837309e58d208183f81d8344996744292cf Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Thu, 11 Mar 2010 17:55:41 +0100 Subject: [PATCH] Handle deleted IOHandlers in a single buffer Signed-off-by: Juan Quintela Signed-off-by: Anthony Liguori --- vl.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/vl.c b/vl.c index 1e23d56444..d69250ca26 100644 --- a/vl.c +++ b/vl.c @@ -2836,20 +2836,17 @@ void main_loop_wait(int nonblocking) if (ret > 0) { IOHandlerRecord *pioh; - QLIST_FOREACH(ioh, &io_handlers, next) { - if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) { - ioh->fd_read(ioh->opaque); - } - if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) { - ioh->fd_write(ioh->opaque); - } - } - - /* remove deleted IO handlers */ QLIST_FOREACH_SAFE(ioh, &io_handlers, next, pioh) { if (ioh->deleted) { QLIST_REMOVE(ioh, next); qemu_free(ioh); + continue; + } + if (ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) { + ioh->fd_read(ioh->opaque); + } + if (ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) { + ioh->fd_write(ioh->opaque); } } } -- 2.11.4.GIT