mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
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>
This commit is contained in:
parent
12c1c7d7ce
commit
b89d92f3cf
2 changed files with 44 additions and 0 deletions
|
@ -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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue