mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
util/async: Add aio_co_reschedule_self()
Add a function that can be used to move the currently running coroutine to a different AioContext (and therefore potentially a different thread). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20201005155855.256490-12-kwolf@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
bb4b9ead95
commit
26b0b698c0
2 changed files with 40 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
|||
#ifdef CONFIG_LINUX_IO_URING
|
||||
#include <liburing.h>
|
||||
#endif
|
||||
#include "qemu/coroutine.h"
|
||||
#include "qemu/queue.h"
|
||||
#include "qemu/event_notifier.h"
|
||||
#include "qemu/thread.h"
|
||||
|
@ -654,6 +655,15 @@ static inline bool aio_node_check(AioContext *ctx, bool is_external)
|
|||
*/
|
||||
void aio_co_schedule(AioContext *ctx, struct Coroutine *co);
|
||||
|
||||
/**
|
||||
* aio_co_reschedule_self:
|
||||
* @new_ctx: the new context
|
||||
*
|
||||
* Move the currently running coroutine to new_ctx. If the coroutine is already
|
||||
* running in new_ctx, do nothing.
|
||||
*/
|
||||
void coroutine_fn aio_co_reschedule_self(AioContext *new_ctx);
|
||||
|
||||
/**
|
||||
* aio_co_wake:
|
||||
* @co: the coroutine
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue