coroutine: add co_aio_sleep_ns() to allow sleep in block drivers

This helper function behaves similarly to co_sleep_ns(), but the
sleeping coroutine will be resumed when using qemu_aio_wait().

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Tested-by: Liu Yuan <namei.unix@gmail.com>
Reviewed-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
MORITA Kazutaka 2013-10-24 16:01:14 +09:00 committed by Kevin Wolf
parent 72e0996c41
commit 3ab7bd1917
2 changed files with 23 additions and 0 deletions

View file

@ -215,6 +215,15 @@ void qemu_co_rwlock_unlock(CoRwlock *lock);
*/
void coroutine_fn co_sleep_ns(QEMUClockType type, int64_t ns);
/**
* Yield the coroutine for a given duration
*
* Behaves similarly to co_sleep_ns(), but the sleeping coroutine will be
* resumed when using qemu_aio_wait().
*/
void coroutine_fn co_aio_sleep_ns(AioContext *ctx, QEMUClockType type,
int64_t ns);
/**
* Yield until a file descriptor becomes readable
*