From 5b9218a3c267cb51a389af14e88f5b4a0d3a77ea Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 17 Feb 2013 16:41:41 +0100 Subject: 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 Reviewed-by: Jeremy Allison --- lib/tevent/tevent_standard.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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) { -- cgit