+
+/**
+ * io_out_wait - leave the output plan idle until something wakes us.
+ * @conn: the connection that plan is for.
+ * @waitaddr: the address to wait on.
+ * @next: function to call after waiting.
+ * @arg: @next argument
+ *
+ * io_wait() makes the input plan idle: if you're not using io_duplex it
+ * doesn't matter which plan is waiting. Otherwise, you may need to use
+ * io_out_wait() instead, to specify explicitly that the output plan is
+ * waiting.
+ */
+#define io_out_wait(conn, waitaddr, next, arg) \
+ io_out_wait_((conn), (waitaddr), \
+ typesafe_cb_preargs(struct io_plan *, void *, \
+ (next), (arg), \
+ struct io_conn *), \
+ (arg))
+
+struct io_plan *io_out_wait_(struct io_conn *conn,
+ const void *wait,
+ struct io_plan *(*next)(struct io_conn *, void *),
+ void *arg);
+
+/**
+ * io_wake - wake up any connections waiting on @wait
+ * @waitaddr: the address to trigger.
+ *
+ * All io_conns who have returned io_wait() on @waitaddr will move on
+ * to their next callback.
+ *
+ * Example:
+ * static struct io_plan *wake_it(struct io_conn *conn, void *b)
+ * {
+ * io_wake(b);
+ * return io_close(conn);
+ * }
+ */
+void io_wake(const void *wait);
+
+/**
+ * io_break - return from io_loop()
+ * @ret: non-NULL value to return from io_loop().
+ *
+ * This breaks out of the io_loop. As soon as the current function
+ * returns, any io_close()'d connections will have their finish
+ * callbacks called, then io_loop() with return with @ret.
+ *
+ * If io_loop() is called again, then @plan will be carried out.
+ *
+ * Example:
+ * static struct io_plan *fail_on_timeout(struct io_conn *conn, char *msg)
+ * {
+ * io_break(msg);
+ * return io_close(conn);
+ * }
+ */
+void io_break(const void *ret);
+
+/**
+ * io_never - assert if callback is called.
+ * @conn: the connection that plan is for.
+ * @unused: an unused parameter to make this suitable for use as a callback.
+ *
+ * Sometimes you want to make it clear that a callback should never happen
+ * (eg. for io_break). This will assert() if called.
+ *
+ * Example:
+ * static struct io_plan *break_out(struct io_conn *conn, void *unused)
+ * {
+ * io_break(conn);
+ * // We won't ever return from io_break
+ * return io_never(conn, NULL);
+ * }
+ */
+struct io_plan *io_never(struct io_conn *conn, void *unused);
+