]> git.ozlabs.org Git - petitboot/commitdiff
lib/waiter: Ensure waiters are consistent during waiter_poll
authorJeremy Kerr <jk@ozlabs.org>
Fri, 17 May 2013 01:38:07 +0000 (09:38 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Tue, 21 May 2013 07:29:43 +0000 (15:29 +0800)
We have a bug at the moment: if the waitset's->waiters array is updated
duing waiter_poll() (eg, a client connection is closed, and the client's
callback performs a waiter_remove()), then we may invoke callbacks for
incorrect waiters.

This change uses a consistent waiters array duing execution of
waiter_poll, so that any pollfds returned from poll() will result in
correct callback invocations.

This assumes that a waiter will only ever remove *itself* from the
waitset; otherwise, we may call a free()ed waiter.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

No differences found