aboutsummaryrefslogtreecommitdiff
path: root/include/qemu/co-shared-resource.h
diff options
context:
space:
mode:
authorEmanuele Giuseppe Esposito <eesposit@redhat.com>2021-06-14 10:11:30 +0200
committerVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>2021-06-25 14:24:24 +0300
commit55fa54a789f6e66fe9e7997429667e3e8917ffb9 (patch)
tree6d9d0e779bb5b5f885ea0ddfc0028049866d1a8a /include/qemu/co-shared-resource.h
parenta7b4f8fc09ec62d09a11cce72a886c453636c547 (diff)
downloadqemu-55fa54a789f6e66fe9e7997429667e3e8917ffb9.zip
qemu-55fa54a789f6e66fe9e7997429667e3e8917ffb9.tar.gz
qemu-55fa54a789f6e66fe9e7997429667e3e8917ffb9.tar.bz2
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>
Diffstat (limited to 'include/qemu/co-shared-resource.h')
-rw-r--r--include/qemu/co-shared-resource.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/include/qemu/co-shared-resource.h b/include/qemu/co-shared-resource.h
index 4e45030..78ca585 100644
--- a/include/qemu/co-shared-resource.h
+++ b/include/qemu/co-shared-resource.h
@@ -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);