- /* Now figure out how long to wait for the next one. */
- if (timer_earliest(&timeouts, &first)) {
- uint64_t f = time_to_msec(time_sub(first, now));
- if (f < INT_MAX)
- timeout = f;
- }
- }
+ while ((conn = list_pop(&always, struct io_conn, always)) != NULL) {
+ assert(conn->plan[IO_IN].status == IO_ALWAYS
+ || conn->plan[IO_OUT].status == IO_ALWAYS);
+
+ /* Re-initialize, for next time. */
+ list_node_init(&conn->always);
+ io_do_always(conn);
+ ret = true;
+ }
+ return ret;
+}
+
+/* This is the main loop. */
+void *io_loop(struct timers *timers, struct timer **expired)
+{
+ void *ret;
+
+ /* if timers is NULL, expired must be. If not, not. */
+ assert(!timers == !expired);
+
+ /* Make sure this is NULL if we exit for some other reason. */
+ if (expired)
+ *expired = NULL;