mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 08:13:54 -06:00
lockable: replaced locks with lock guard macros where appropriate
- ran regexp "qemu_mutex_lock\(.*\).*\n.*if" to find targets - replaced result with QEMU_LOCK_GUARD if all unlocks at function end - replaced result with WITH_QEMU_LOCK_GUARD if unlock not at end Signed-off-by: Daniel Brodsky <dnbrdsky@gmail.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Message-id: 20200404042108.389635-3-dnbrdsky@gmail.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
56f21718b8
commit
6e8a355de6
15 changed files with 83 additions and 106 deletions
|
@ -18,6 +18,7 @@
|
|||
#include "qemu/osdep.h"
|
||||
#include "ui/qemu-spice.h"
|
||||
#include "qemu/timer.h"
|
||||
#include "qemu/lockable.h"
|
||||
#include "qemu/main-loop.h"
|
||||
#include "qemu/option.h"
|
||||
#include "qemu/queue.h"
|
||||
|
@ -483,12 +484,12 @@ void qemu_spice_display_refresh(SimpleSpiceDisplay *ssd)
|
|||
{
|
||||
graphic_hw_update(ssd->dcl.con);
|
||||
|
||||
qemu_mutex_lock(&ssd->lock);
|
||||
if (QTAILQ_EMPTY(&ssd->updates) && ssd->ds) {
|
||||
qemu_spice_create_update(ssd);
|
||||
ssd->notify++;
|
||||
WITH_QEMU_LOCK_GUARD(&ssd->lock) {
|
||||
if (QTAILQ_EMPTY(&ssd->updates) && ssd->ds) {
|
||||
qemu_spice_create_update(ssd);
|
||||
ssd->notify++;
|
||||
}
|
||||
}
|
||||
qemu_mutex_unlock(&ssd->lock);
|
||||
|
||||
trace_qemu_spice_display_refresh(ssd->qxl.id, ssd->notify);
|
||||
if (ssd->notify) {
|
||||
|
@ -580,7 +581,7 @@ static int interface_get_cursor_command(QXLInstance *sin, QXLCommandExt *ext)
|
|||
SimpleSpiceDisplay *ssd = container_of(sin, SimpleSpiceDisplay, qxl);
|
||||
int ret;
|
||||
|
||||
qemu_mutex_lock(&ssd->lock);
|
||||
QEMU_LOCK_GUARD(&ssd->lock);
|
||||
if (ssd->ptr_define) {
|
||||
*ext = ssd->ptr_define->ext;
|
||||
ssd->ptr_define = NULL;
|
||||
|
@ -592,7 +593,6 @@ static int interface_get_cursor_command(QXLInstance *sin, QXLCommandExt *ext)
|
|||
} else {
|
||||
ret = false;
|
||||
}
|
||||
qemu_mutex_unlock(&ssd->lock);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue