]> git.proxmox.com Git - mirror_qemu.git/commit
ui/cocoa: Run qemu_init in the main thread
authorAkihiko Odaki <akihiko.odaki@gmail.com>
Fri, 19 Aug 2022 13:27:54 +0000 (22:27 +0900)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 23 Sep 2022 12:36:33 +0000 (14:36 +0200)
commitbab6a301c58286229ca8fbc36728d1469f243260
tree82377727d84f3d0a6c8348fe9073d530d1b4c3d9
parentdf6322a8973b5e69bdc8931ff79d3bfe3901cab5
ui/cocoa: Run qemu_init in the main thread

This work is based on:
https://patchew.org/QEMU/20220317125534.38706-1-philippe.mathieu.daude@gmail.com/

Simplify the initialization dance by running qemu_init() in the main
thread before the Cocoa event loop starts. The secondary thread only
runs only qemu_main_loop() and qemu_cleanup().

This fixes a case where addRemovableDevicesMenuItems() calls
qmp_query_block() while expecting the main thread to still hold
the BQL.

Overriding the code after calling qemu_init() is done by dynamically
replacing a function pointer variable, qemu_main when initializing
ui/cocoa, which unifies the static implementation of main() for
builds with ui/cocoa and ones without ui/cocoa.

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Message-Id: <20220819132756.74641-2-akihiko.odaki@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
docs/devel/fuzzing.rst
include/qemu-main.h
include/sysemu/sysemu.h
softmmu/main.c
softmmu/vl.c
tests/qtest/fuzz/fuzz.c
ui/cocoa.m