From: Juan Quintela Date: Thu, 11 Mar 2010 16:55:41 +0000 (+0100) Subject: Handle deleted IOHandlers in a single buffer X-Git-Tag: v0.13.0-rc0~1037 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4bed9837309e58d208183f81d8344996744292cf;p=thirdparty%2Fqemu.git Handle deleted IOHandlers in a single buffer Signed-off-by: Juan Quintela Signed-off-by: Anthony Liguori --- diff --git a/vl.c b/vl.c index 1e23d564440..d69250ca266 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); } } }