aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAkihiko Odaki <akihiko.odaki@gmail.com>2022-08-19 22:27:54 +0900
committerGerd Hoffmann <kraxel@redhat.com>2022-09-23 14:36:33 +0200
commitbab6a301c58286229ca8fbc36728d1469f243260 (patch)
tree82377727d84f3d0a6c8348fe9073d530d1b4c3d9 /include
parentdf6322a8973b5e69bdc8931ff79d3bfe3901cab5 (diff)
downloadqemu-bab6a301c58286229ca8fbc36728d1469f243260.zip
qemu-bab6a301c58286229ca8fbc36728d1469f243260.tar.gz
qemu-bab6a301c58286229ca8fbc36728d1469f243260.tar.bz2
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>
Diffstat (limited to 'include')
-rw-r--r--include/qemu-main.h3
-rw-r--r--include/sysemu/sysemu.h2
2 files changed, 3 insertions, 2 deletions
diff --git a/include/qemu-main.h b/include/qemu-main.h
index 6a3e90d..940960a 100644
--- a/include/qemu-main.h
+++ b/include/qemu-main.h
@@ -5,6 +5,7 @@
#ifndef QEMU_MAIN_H
#define QEMU_MAIN_H
-int qemu_main(int argc, char **argv, char **envp);
+int qemu_default_main(void);
+extern int (*qemu_main)(void);
#endif /* QEMU_MAIN_H */
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 31aa451..6a7a31e 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -102,7 +102,7 @@ void qemu_boot_set(const char *boot_order, Error **errp);
bool defaults_enabled(void);
-void qemu_init(int argc, char **argv, char **envp);
+void qemu_init(int argc, char **argv);
int qemu_main_loop(void);
void qemu_cleanup(void);