mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
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>
This commit is contained in:
parent
a7b4f8fc09
commit
55fa54a789
2 changed files with 20 additions and 8 deletions
|
@ -26,15 +26,13 @@
|
|||
#ifndef QEMU_CO_SHARED_RESOURCE_H
|
||||
#define QEMU_CO_SHARED_RESOURCE_H
|
||||
|
||||
|
||||
/* Accesses to co-shared-resource API are thread-safe */
|
||||
typedef struct SharedResource SharedResource;
|
||||
|
||||
/*
|
||||
* Create SharedResource structure
|
||||
*
|
||||
* @total: total amount of some resource to be shared between clients
|
||||
*
|
||||
* Note: this API is not thread-safe.
|
||||
*/
|
||||
SharedResource *shres_create(uint64_t total);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue