bottom halves: introduce bh call function

This patch introduces aio_bh_call function. It is used to execute
bottom halves as callbacks without adding them to the queue.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@ispras.ru>
Message-Id: <20150917162450.8676.56980.stgit@PASHA-ISP.def.inno>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru>
This commit is contained in:
Pavel Dovgalyuk 2015-09-17 19:24:50 +03:00 committed by Paolo Bonzini
parent 8bd7f71d79
commit df281b80b9
2 changed files with 11 additions and 1 deletions

View file

@ -59,6 +59,11 @@ QEMUBH *aio_bh_new(AioContext *ctx, QEMUBHFunc *cb, void *opaque)
return bh; return bh;
} }
void aio_bh_call(QEMUBH *bh)
{
bh->cb(bh->opaque);
}
/* Multiple occurrences of aio_bh_poll cannot be called concurrently */ /* Multiple occurrences of aio_bh_poll cannot be called concurrently */
int aio_bh_poll(AioContext *ctx) int aio_bh_poll(AioContext *ctx)
{ {
@ -84,7 +89,7 @@ int aio_bh_poll(AioContext *ctx)
ret = 1; ret = 1;
} }
bh->idle = 0; bh->idle = 0;
bh->cb(bh->opaque); aio_bh_call(bh);
} }
} }

View file

@ -208,6 +208,11 @@ void aio_notify(AioContext *ctx);
*/ */
void aio_notify_accept(AioContext *ctx); void aio_notify_accept(AioContext *ctx);
/**
* aio_bh_call: Executes callback function of the specified BH.
*/
void aio_bh_call(QEMUBH *bh);
/** /**
* aio_bh_poll: Poll bottom halves for an AioContext. * aio_bh_poll: Poll bottom halves for an AioContext.
* *