Re: [PATCH 04/11] rust/qemu-api: Add wrappers to run futures in QEMU

2025-02-18 Thread Kevin Wolf
Am 12.02.2025 um 14:22 hat Paolo Bonzini geschrieben: > > > Also, would qemu_co_run_future() and qemu_run_future() become methods on > > > an > > > Executor later? Maybe it make sense to have already something like > > > > > > pub trait QemuExecutor { > > > fn run_until(future: F) -> F::Outpu

Re: [PATCH 04/11] rust/qemu-api: Add wrappers to run futures in QEMU

2025-02-12 Thread Paolo Bonzini
On Wed, Feb 12, 2025 at 1:47 PM Kevin Wolf wrote: > > > +pub fn qemu_co_run_future(future: F) -> F::Output { > > > +let waker = Arc::new(RunFutureWaker { > > > +co: unsafe { bindings::qemu_coroutine_self() }, > > > +}) > > > +.into(); > > > > into what? :) Maybe you can add th

Re: [PATCH 04/11] rust/qemu-api: Add wrappers to run futures in QEMU

2025-02-12 Thread Kevin Wolf
Am 12.02.2025 um 10:28 hat Paolo Bonzini geschrieben: > On 2/11/25 22:43, Kevin Wolf wrote: > > +/// Use QEMU's event loops to run a Rust [`Future`] to completion and > > return its result. > > +/// > > +/// This function must be called in coroutine context. If the future isn't > > ready yet, it

Re: [PATCH 04/11] rust/qemu-api: Add wrappers to run futures in QEMU

2025-02-12 Thread Paolo Bonzini
On 2/11/25 22:43, Kevin Wolf wrote: +/// Use QEMU's event loops to run a Rust [`Future`] to completion and return its result. +/// +/// This function must be called in coroutine context. If the future isn't ready yet, it yields. +pub fn qemu_co_run_future(future: F) -> F::Output { +let wake

[PATCH 04/11] rust/qemu-api: Add wrappers to run futures in QEMU

2025-02-11 Thread Kevin Wolf
This adds helper functions that allow running Rust futures to completion using QEMU's event loops. Signed-off-by: Kevin Wolf --- include/qemu/coroutine-rust.h | 24 +++ rust/wrapper.h| 1 + util/qemu-co-rust-async.c | 55 rust/qemu-api/meson.