Simplify the initialization dance by running qemu_init() in the main
thread before the Cocoa event loop starts. The cocoa_display_init()
code that is post-applicationDidFinishLaunching: moves to the
application delegate itself, and the secondary thread only runs
the rest of qemu_main(), namely 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. The newly-introduced assertions in the block layer
complain about this.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
softmmu/main.c | 12 +++--
ui/cocoa.m | 122 +++++++++++++++++++------------------------------
2 files changed, 53 insertions(+), 81 deletions(-)