]> git.proxmox.com Git - mirror_qemu.git/commit
monitor: prevent inserting new monitors after cleanup
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 5 Dec 2018 20:37:36 +0000 (00:37 +0400)
committerMarkus Armbruster <armbru@redhat.com>
Wed, 12 Dec 2018 08:55:57 +0000 (09:55 +0100)
commit8dac00bbfbca1fa793b8ad410a4373e97599102d
tree5522fed1781b37dc260b68024729b6d7b0d1f0d0
parent269d25cdeb3acecf0033d6809dd7e23ebbc78ce9
monitor: prevent inserting new monitors after cleanup

monitor_cleanup() is one of the last things main() calls before it
returns.  In the following patch, monitor_cleanup() will release the
monitor_lock during flushing. There may be pending commands to insert
new monitors, which would modify the mon_list during iteration, and
the clean-up could thus miss those new insertions.

Add a monitor_destroyed global to check if monitor_cleanup() has been
already called. In this case, don't insert the new monitor in the
list, but free it instead. A cleaner solution would involve the main
thread telling other threads to terminate, waiting for their
termination.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181205203737.9011-7-marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
monitor.c