Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
monitor: allow calling monitor_resume under mon_lock
Move monitor_resume()'s call to readline_show_prompt() outside the
potentially locked section.  Reuse the existing monitor_accept_input()
bottom half for this purpose.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
bonzini committed May 25, 2023
1 parent e37548e commit c5d0c55
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions monitor/monitor.c
Expand Up @@ -567,6 +567,12 @@ static void monitor_accept_input(void *opaque)
{
Monitor *mon = opaque;

if (!monitor_is_qmp(mon)) {
MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
assert(hmp_mon->rs);
readline_show_prompt(hmp_mon->rs);
}

qemu_chr_fe_accept_input(&mon->chr);
}

Expand All @@ -585,12 +591,6 @@ void monitor_resume(Monitor *mon)
ctx = qemu_get_aio_context();
}

if (!monitor_is_qmp(mon)) {
MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
assert(hmp_mon->rs);
readline_show_prompt(hmp_mon->rs);
}

aio_bh_schedule_oneshot(ctx, monitor_accept_input, mon);
}

Expand Down

0 comments on commit c5d0c55

Please sign in to comment.