diff options
author | Stefan Metzmacher <metze@samba.org> | 2013-02-17 16:41:41 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2013-03-01 12:00:24 -0800 |
commit | 5b9218a3c267cb51a389af14e88f5b4a0d3a77ea (patch) | |
tree | 00bc313a140ce53f123d26059f449fd0827d3688 | |
parent | 3fc93164fb83e396e2b757672d65269509fa7148 (diff) | |
download | samba-5b9218a3c267cb51a389af14e88f5b4a0d3a77ea.tar.gz samba-5b9218a3c267cb51a389af14e88f5b4a0d3a77ea.tar.bz2 samba-5b9218a3c267cb51a389af14e88f5b4a0d3a77ea.zip |
tevent: add std_event_loop_wait()
We also need to fallback in tevent_loop_wait()
otherwise we might miss events in the poll->fresh list.
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | lib/tevent/tevent_standard.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/tevent/tevent_standard.c b/lib/tevent/tevent_standard.c index a9c6170320..258499484a 100644 --- a/lib/tevent/tevent_standard.c +++ b/lib/tevent/tevent_standard.c @@ -127,6 +127,22 @@ static int std_event_loop_once(struct tevent_context *ev, const char *location) return glue->poll_ops->loop_once(ev, location); } +static int std_event_loop_wait(struct tevent_context *ev, const char *location) +{ + void *glue_ptr = talloc_parent(ev->ops); + struct std_event_glue *glue = + talloc_get_type_abort(glue_ptr, + struct std_event_glue); + int ret; + + ret = glue->epoll_ops->loop_wait(ev, location); + if (glue->epoll_ops != NULL) { + /* No fallback */ + return ret; + } + + return glue->poll_ops->loop_wait(ev, location); +} /* Initialize the epoll backend and allow it to call a switch function if epoll fails at runtime. @@ -183,6 +199,7 @@ static int std_event_context_init(struct tevent_context *ev) *glue->glue_ops = *glue->epoll_ops; glue->glue_ops->context_init = std_event_context_init; glue->glue_ops->loop_once = std_event_loop_once; + glue->glue_ops->loop_wait = std_event_loop_wait; ret = glue->epoll_ops->context_init(ev); if (ret == -1) { |