diff options
| author | Stefan Hajnoczi | 2018-03-07 15:42:02 +0100 |
|---|---|---|
| committer | Stefan Hajnoczi | 2018-03-08 18:38:51 +0100 |
| commit | b89d92f3cfc0f6e6d05e146e7a5fb8c759978051 (patch) | |
| tree | 36927b2b1c7f082a20f890ee7e4d5b0b84ce6f90 /include | |
| parent | virtio-blk: dataplane: Don't batch notifications if EVENT_IDX is present (diff) | |
| download | qemu-b89d92f3cfc0f6e6d05e146e7a5fb8c759978051.tar.gz qemu-b89d92f3cfc0f6e6d05e146e7a5fb8c759978051.tar.xz qemu-b89d92f3cfc0f6e6d05e146e7a5fb8c759978051.zip | |
block: add aio_wait_bh_oneshot()
Sometimes it's necessary for the main loop thread to run a BH in an
IOThread and wait for its completion. This primitive is useful during
startup/shutdown to synchronize and avoid race conditions.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20180307144205.20619-2-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/block/aio-wait.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/block/aio-wait.h b/include/block/aio-wait.h index a48c744fa8..f7a3972200 100644 --- a/include/block/aio-wait.h +++ b/include/block/aio-wait.h @@ -113,4 +113,17 @@ typedef struct { */ void aio_wait_kick(AioWait *wait); +/** + * aio_wait_bh_oneshot: + * @ctx: the aio context + * @cb: the BH callback function + * @opaque: user data for the BH callback function + * + * Run a BH in @ctx and wait for it to complete. + * + * Must be called from the main loop thread with @ctx acquired exactly once. + * Note that main loop event processing may occur. + */ +void aio_wait_bh_oneshot(AioContext *ctx, QEMUBHFunc *cb, void *opaque); + #endif /* QEMU_AIO_WAIT */ |
