diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2010-12-01 07:11:51 +0200 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2010-12-01 07:11:51 +0200 |
commit | c924f36a300cbc54d3cb511116e8e2bae17f5ae6 (patch) | |
tree | 04e57676b1db1db7d8b33934b349f8f37780fa2a /vl.c | |
parent | 1abeb5a65d515f8a8a9cfc4a82342f731bd9321f (diff) | |
parent | 09fa35e5cdc7d17ed3e1528ca743893ae77a0ea2 (diff) | |
download | qemu-c924f36a300cbc54d3cb511116e8e2bae17f5ae6.tar.gz qemu-c924f36a300cbc54d3cb511116e8e2bae17f5ae6.tar.bz2 qemu-c924f36a300cbc54d3cb511116e8e2bae17f5ae6.zip |
Merge remote branch 'origin/master' into pci
Conflicts:
Makefile.objs
hw/virtio.c
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -158,6 +158,7 @@ int main(int argc, char **argv) #include "slirp/libslirp.h" +#include "trace.h" #include "qemu-queue.h" #include "cpus.h" #include "arch_init.h" @@ -1074,6 +1075,8 @@ void vm_state_notify(int running, int reason) { VMChangeStateEntry *e; + trace_vm_state_notify(running, reason); + for (e = vm_change_state_head.lh_first; e; e = e->entries.le_next) { e->cb(e->opaque, running, reason); } @@ -1249,17 +1252,18 @@ void main_loop_wait(int nonblocking) IOHandlerRecord *pioh; 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)) { + if (!ioh->deleted && ioh->fd_read && FD_ISSET(ioh->fd, &rfds)) { ioh->fd_read(ioh->opaque); } - if (ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) { + if (!ioh->deleted && ioh->fd_write && FD_ISSET(ioh->fd, &wfds)) { ioh->fd_write(ioh->opaque); } + + /* Do this last in case read/write handlers marked it for deletion */ + if (ioh->deleted) { + QLIST_REMOVE(ioh, next); + qemu_free(ioh); + } } } |