monitor: use QEMU_LOCK_GUARD a bit more

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2023-05-17 14:47:55 +02:00
parent 690705ca0b
commit e37548ef13

View File

@ -161,10 +161,9 @@ static gboolean monitor_unblocked(void *do_not_use, GIOCondition cond,
{ {
Monitor *mon = opaque; Monitor *mon = opaque;
qemu_mutex_lock(&mon->mon_lock); QEMU_LOCK_GUARD(&mon->mon_lock);
mon->out_watch = 0; mon->out_watch = 0;
monitor_flush_locked(mon); monitor_flush_locked(mon);
qemu_mutex_unlock(&mon->mon_lock);
return FALSE; return FALSE;
} }
@ -203,9 +202,8 @@ static void monitor_flush_locked(Monitor *mon)
void monitor_flush(Monitor *mon) void monitor_flush(Monitor *mon)
{ {
qemu_mutex_lock(&mon->mon_lock); QEMU_LOCK_GUARD(&mon->mon_lock);
monitor_flush_locked(mon); monitor_flush_locked(mon);
qemu_mutex_unlock(&mon->mon_lock);
} }
/* flush at every end of line */ /* flush at every end of line */