mirror of
https://github.com/qemu/qemu.git
synced 2026-07-08 17:46:17 +00:00
net/colo-compare: Use QEMU_LOCK_GUARD to simplify mutex handling
Replace qemu_mutex_(un)lock() calls with the QEMU_LOCK_GUARD(). Signed-off-by: Evgeny Kolmakov <randomjack94dev@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Zhang Chen <zhangckid@gmail.com> Reviewed-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
committed by
Michael Tokarev
parent
ae84c738e4
commit
51395f054a
@@ -902,14 +902,13 @@ static void check_old_packet_regular(void *opaque)
|
||||
void colo_notify_compares_event(void *opaque, int event, Error **errp)
|
||||
{
|
||||
CompareState *s;
|
||||
qemu_mutex_lock(&colo_compare_mutex);
|
||||
QEMU_LOCK_GUARD(&colo_compare_mutex);
|
||||
|
||||
if (!colo_compare_active) {
|
||||
qemu_mutex_unlock(&colo_compare_mutex);
|
||||
return;
|
||||
}
|
||||
|
||||
qemu_mutex_lock(&event_mtx);
|
||||
QEMU_LOCK_GUARD(&event_mtx);
|
||||
QTAILQ_FOREACH(s, &net_compares, next) {
|
||||
s->event = event;
|
||||
qemu_bh_schedule(s->event_bh);
|
||||
@@ -919,9 +918,6 @@ void colo_notify_compares_event(void *opaque, int event, Error **errp)
|
||||
while (event_unhandled_count > 0) {
|
||||
qemu_cond_wait(&event_complete_cond, &event_mtx);
|
||||
}
|
||||
|
||||
qemu_mutex_unlock(&event_mtx);
|
||||
qemu_mutex_unlock(&colo_compare_mutex);
|
||||
}
|
||||
|
||||
static void colo_compare_timer_init(CompareState *s)
|
||||
|
||||
Reference in New Issue
Block a user