X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Fio%2Fpoll.c;h=8ba376a549aa47ee4be29af3345c034dfdfbf481;hp=e3f595c9884c0d2fcea42d598ca3321d067069a8;hb=f7ab2c65d40839a327e50876dc2708ab7b11aa52;hpb=cdf62dce7077a9f9a818edbb67d31d033cbb73c6;ds=sidebyside diff --git a/ccan/io/poll.c b/ccan/io/poll.c index e3f595c9..8ba376a5 100644 --- a/ccan/io/poll.c +++ b/ccan/io/poll.c @@ -167,6 +167,34 @@ void backend_plan_changed(struct io_conn *conn) some_always = true; } +void backend_wait_changed(const void *wait) +{ + unsigned int i; + + for (i = 0; i < num_fds; i++) { + struct io_conn *c, *duplex; + + /* Ignore listeners */ + if (fds[i]->listener) + continue; + c = (void *)fds[i]; + for (duplex = c->duplex; c; c = duplex, duplex = NULL) { + /* Ignore closing. */ + if (!c->plan.next) + continue; + /* Not idle? */ + if (c->plan.io) + continue; + /* Waiting on something else? */ + if (c->plan.u1.const_vp != wait) + continue; + /* Make it do the next thing. */ + c->plan = io_always_(c->plan.next, c->plan.next_arg); + backend_plan_changed(c); + } + } +} + bool add_conn(struct io_conn *c) { if (!add_fd(&c->fd, c->plan.pollflag & (POLLIN|POLLOUT)))