--On 6 July 2013 17:24:57 +0100 Alex Bligh <a...@alex.org.uk> wrote:
Add timed bottom halves. A timed bottom half is a bottom half that will not execute until a given time has passed (qemu_bh_schedule_at) or a given interval has passed (qemu_bh_schedule_in). Any qemu clock can be used, and times are specified in nanoseconds.
For background, this patch resulted from a discussion with Kevin & Stefan on IRC as to the best way to use timers (or rather avoid using timers) in block drivers. There is one thing I'm not entirely sure about:
+void qemu_bh_schedule_at(QEMUBH *bh, QEMUClock *clock, int64_t time) +{ + /* Allow rescheduling if already scheduled */ + bh->scheduled = 1; + bh->idle = 0; + bh->clock = clock; + bh->time = time; + aio_notify(bh->ctx); /*FIXME: is this right?*/ +}
qemu_bh_schedule calls aio_notify, but qemu_bh_schedule_idle does not. I am not quite sure why the latter doesn't - possibly through not fully understanding the aio system. Should qemu_bh_schedule_at be calling this, when I don't know whether the bh is scheduled for 1 nanosecond ahead or 1 second? -- Alex Bligh