summaryrefslogtreecommitdiffstats
path: root/include/qemu/main-loop.h
diff options
context:
space:
mode:
authorStefan Hajnoczi2018-06-02 10:52:59 +0200
committerPaolo Bonzini2018-06-28 19:05:30 +0200
commitd29a8a1b0758a905b148929dd14b79bfeb297a80 (patch)
tree66a6ec6a7634ec89db11ab204b223419694f4345 /include/qemu/main-loop.h
parentchardev: don't splatter terminal settings on exit if not previously set (diff)
downloadqemu-d29a8a1b0758a905b148929dd14b79bfeb297a80.tar.gz
qemu-d29a8a1b0758a905b148929dd14b79bfeb297a80.tar.xz
qemu-d29a8a1b0758a905b148929dd14b79bfeb297a80.zip
main-loop: document IOCanReadHandler
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20180602085259.17853-1-stefanha@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'include/qemu/main-loop.h')
-rw-r--r--include/qemu/main-loop.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h
index 6b4b60bf6d..721aa2416a 100644
--- a/include/qemu/main-loop.h
+++ b/include/qemu/main-loop.h
@@ -168,6 +168,20 @@ void qemu_del_wait_object(HANDLE handle, WaitObjectFunc *func, void *opaque);
/* async I/O support */
typedef void IOReadHandler(void *opaque, const uint8_t *buf, int size);
+
+/**
+ * IOCanReadHandler: Return the number of bytes that #IOReadHandler can accept
+ *
+ * This function reports how many bytes #IOReadHandler is prepared to accept.
+ * #IOReadHandler may be invoked with up to this number of bytes. If this
+ * function returns 0 then #IOReadHandler is not invoked.
+ *
+ * This function is typically called from an event loop. If the number of
+ * bytes changes outside the event loop (e.g. because a vcpu thread drained the
+ * buffer), then it is necessary to kick the event loop so that this function
+ * is called again. aio_notify() or qemu_notify_event() can be used to kick
+ * the event loop.
+ */
typedef int IOCanReadHandler(void *opaque);
/**