qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 46/53] blockdev: add note that block_job_cb() must be


From: Stefan Hajnoczi
Subject: [Qemu-devel] [PULL 46/53] blockdev: add note that block_job_cb() must be thread-safe
Date: Mon, 3 Nov 2014 11:50:49 +0000

This function is correct but we should document the constraint that
everything must be thread-safe.

Emitting QMP events and scheduling BHs are both thread-safe so nothing
needs to be done here.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Max Reitz <address@hidden>
Message-id: address@hidden
---
 blockdev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/blockdev.c b/blockdev.c
index 741df98..774051b 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -1929,6 +1929,11 @@ out:
 
 static void block_job_cb(void *opaque, int ret)
 {
+    /* Note that this function may be executed from another AioContext besides
+     * the QEMU main loop.  If you need to access anything that assumes the
+     * QEMU global mutex, use a BH or introduce a mutex.
+     */
+
     BlockDriverState *bs = opaque;
     const char *msg = NULL;
 
-- 
1.9.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]