]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: start/stop an event loop thread for domains
authorDaniel P. Berrangé <berrange@redhat.com>
Wed, 12 Feb 2020 12:26:11 +0000 (12:26 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Wed, 11 Mar 2020 14:44:44 +0000 (14:44 +0000)
commite6afacb0feabd9bf58331aa0e5259a35378be74e
tree22894ed4129459fbe173babac11efb2548acbdd8
parent5c146f6e571d94955b5c2ced38803407b1c52e06
qemu: start/stop an event loop thread for domains

The event loop thread will be responsible for handling
any per-domain I/O operations, most notably the QEMU
monitor and agent sockets.

We start this event loop when launching QEMU, but stopping
the event loop is a little more complicated. The obvious
idea is to stop it in qemuProcessStop(), but if we do that
we risk loosing the final events from the QEMU monitor, as
they might not have been read by the event thread at the
time we tell the thread to stop.

The solution is to delay shutdown of the event thread until
we have seen EOF from the QEMU monitor, and thus we know
there are no further events to process.

Note that this assumes that we don't have events to process
from the QEMU agent.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
src/qemu/qemu_domain.c
src/qemu/qemu_domain.h
src/qemu/qemu_process.c