]> git.ozlabs.org Git - ccan/commitdiff
ccan/io: replace backend_set_state with backend_wakeup()
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 14 Oct 2013 10:58:35 +0000 (21:28 +1030)
We only use it in one place: for wakeup.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/io/backend.h
ccan/io/io.c
ccan/io/poll.c

index d75b516b763e85ef06278ff07271204b19f6c90d..765e920ea9158d149eead5e5bb5d371d2d6f4531 100644 (file)
@@ -103,7 +103,7 @@ bool add_listener(struct io_listener *l);
 bool add_conn(struct io_conn *c);
 bool add_duplex(struct io_conn *c);
 void del_listener(struct io_listener *l);
-void backend_set_state(struct io_conn *conn, struct io_plan *op);
+void backend_wakeup(struct io_conn *conn);
 void backend_add_timeout(struct io_conn *conn, struct timespec ts);
 void backend_del_timeout(struct io_conn *conn);
 
index c725850fd810eeb3e5a14c1ad0e6a64b924a8b6f..f7b46faaa5f8a5da64a07a9dc60caa67dd78d8fc 100644 (file)
@@ -239,7 +239,8 @@ void io_wake_(struct io_conn *conn,
        assert(conn->state == IO_IDLE);
        conn->next = fn;
        conn->next_arg = arg;
-       backend_set_state(conn, to_ioplan(IO_NEXT));
+       conn->state = IO_NEXT;
+       backend_wakeup(conn);
 }
 
 static struct io_plan *do_next(struct io_conn *conn)
index 918e9f270e677e1dcfe83698232422e947172294..0cc84ad913bce7f2b58987407188b38fd0e7f9f9 100644 (file)
@@ -112,7 +112,7 @@ void del_listener(struct io_listener *l)
        del_fd(&l->fd);
 }
 
-void backend_set_state(struct io_conn *conn, struct io_plan *plan)
+static void backend_set_state(struct io_conn *conn, struct io_plan *plan)
 {
        enum io_state state = from_ioplan(plan);
        struct pollfd *pfd = &pollfds[conn->fd.backend_info];
@@ -138,6 +138,11 @@ void backend_set_state(struct io_conn *conn, struct io_plan *plan)
        conn->state = state;
 }
 
+void backend_wakeup(struct io_conn *conn)
+{
+       num_next++;
+}
+
 static void accept_conn(struct io_listener *l)
 {
        struct io_conn *c;