co-shared-resource: protect with a mutex
commit55fa54a789f6e66fe9e7997429667e3e8917ffb9
authorEmanuele Giuseppe Esposito <eesposit@redhat.com>
Mon, 14 Jun 2021 08:11:30 +0000 (14 10:11 +0200)
committerVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Fri, 25 Jun 2021 11:24:24 +0000 (25 14:24 +0300)
tree6d9d0e779bb5b5f885ea0ddfc0028049866d1a8a
parenta7b4f8fc09ec62d09a11cce72a886c453636c547
co-shared-resource: protect with a mutex

co-shared-resource is currently not thread-safe, as also reported
in co-shared-resource.h. Add a QemuMutex because co_try_get_from_shres
can also be invoked from non-coroutine context.

Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
Message-Id: <20210614081130.22134-6-eesposit@redhat.com>
Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
include/qemu/co-shared-resource.h
util/qemu-co-shared-resource.c