| 34 | } |
| 35 | |
| 36 | static struct io_plan poke_reader(struct io_conn *conn, struct buffer *buf) |
| 37 | { |
| 38 | assert(conn == buf->writer); |
| 39 | /* You read. */ |
| 40 | io_wake(buf->reader, |
| 41 | io_read(&buf->buf, sizeof(buf->buf), poke_writer, buf)); |
| 42 | |
| 43 | if (++buf->iters == NUM_ITERS) |
| 44 | return io_close(); |
| 45 | |
| 46 | /* I'll wait until you tell me to write. */ |
| 47 | return io_idle(); |
| 48 | } |
| 49 | |
| 50 | int main(void) |
| 51 | { |