Because of monitor create own iothread, and use the
iothread suspend/resume with bh handler and chardev handler.
The QOM lifecycle is hard to track. Update the legacy usage
of "iothread_get_aio_context()" and "iothread_put_aio_context()".

Signed-off-by: Zhang Chen <[email protected]>
---
 monitor/monitor.c | 4 ++--
 monitor/qmp.c     | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/monitor/monitor.c b/monitor/monitor.c
index 1273eb7260..5da3c05e8d 100644
--- a/monitor/monitor.c
+++ b/monitor/monitor.c
@@ -547,7 +547,7 @@ int monitor_suspend(Monitor *mon)
          * Kick I/O thread to make sure this takes effect.  It'll be
          * evaluated again in prepare() of the watch object.
          */
-        aio_notify(iothread_get_aio_context(mon_iothread));
+        aio_notify(iothread_get_aio_context(mon_iothread, NULL));
     }
 
     trace_monitor_suspend(mon, 1);
@@ -582,7 +582,7 @@ void monitor_resume(Monitor *mon)
         AioContext *ctx;
 
         if (mon->use_io_thread) {
-            ctx = iothread_get_aio_context(mon_iothread);
+            ctx = iothread_get_aio_context(mon_iothread, NULL);
         } else {
             ctx = qemu_get_aio_context();
         }
diff --git a/monitor/qmp.c b/monitor/qmp.c
index 687019811f..93d0328dcd 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
@@ -544,12 +544,13 @@ void monitor_init_qmp(Chardev *chr, bool pretty, Error 
**errp)
          * handling between the main thread and the I/O thread.
          */
         remove_listener_fd_in_watch(chr);
+
         /*
          * We can't call qemu_chr_fe_set_handlers() directly here
          * since chardev might be running in the monitor I/O
          * thread.  Schedule a bottom half.
          */
-        aio_bh_schedule_oneshot(iothread_get_aio_context(mon_iothread),
+        aio_bh_schedule_oneshot(iothread_get_aio_context(mon_iothread, NULL),
                                 monitor_qmp_setup_handlers_bh, mon);
         /* The bottom half will add @mon to @mon_list */
     } else {
-- 
2.49.0


Reply via email to