diff options
author | Juan Quintela <quintela@redhat.com> | 2010-03-11 17:55:41 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2010-03-19 15:27:27 -0500 |
commit | 4bed9837309e58d208183f81d8344996744292cf (patch) | |
tree | 6901a078fdaae24106d36b14a35700a83e254613 /vl.c | |
parent | ca96c316c0a10d7c673063f1bacb7d2c816cf38e (diff) | |
download | qemu-4bed9837309e58d208183f81d8344996744292cf.zip qemu-4bed9837309e58d208183f81d8344996744292cf.tar.gz qemu-4bed9837309e58d208183f81d8344996744292cf.tar.bz2 |
Handle deleted IOHandlers in a single buffer
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 17 |
1 files changed, 7 insertions, 10 deletions
@@ -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); } } } |