summaryrefslogtreecommitdiff
path: root/lib/tevent/tevent.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-03-16 14:15:07 +0100
committerStefan Metzmacher <metze@samba.org>2009-03-17 19:58:57 +0100
commit940e61846e97ba62153d5b977b0823f196607743 (patch)
tree22e0442255cd2d6eca42b6f260a7436c8181a716 /lib/tevent/tevent.c
parent0139befb915006d6ec9fec2734057c5c50b3c383 (diff)
downloadsamba-940e61846e97ba62153d5b977b0823f196607743.tar.gz
samba-940e61846e97ba62153d5b977b0823f196607743.tar.bz2
samba-940e61846e97ba62153d5b977b0823f196607743.zip
tevent: add tevent_common_loop_wait() helper function and use it
tevent_loop_wait should do the same for all backends. It should loop as long as we have pending events. metze
Diffstat (limited to 'lib/tevent/tevent.c')
-rw-r--r--lib/tevent/tevent.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c
index 867cfc08fe..31dc58d98e 100644
--- a/lib/tevent/tevent.c
+++ b/lib/tevent/tevent.c
@@ -514,6 +514,34 @@ done:
/*
return on failure or (with 0) if all fd events are removed
*/
+int tevent_common_loop_wait(struct tevent_context *ev,
+ const char *location)
+{
+ /*
+ * loop as long as we have events pending
+ */
+ while (ev->fd_events ||
+ ev->timer_events ||
+ ev->immediate_events ||
+ ev->signal_events) {
+ int ret;
+ ret = _tevent_loop_once(ev, location);
+ if (ret != 0) {
+ tevent_debug(ev, TEVENT_DEBUG_FATAL,
+ "_tevent_loop_once() failed: %d - %s\n",
+ ret, strerror(errno));
+ return ret;
+ }
+ }
+
+ tevent_debug(ev, TEVENT_DEBUG_WARNING,
+ "tevent_common_loop_wait() out of events\n");
+ return 0;
+}
+
+/*
+ return on failure or (with 0) if all fd events are removed
+*/
int _tevent_loop_wait(struct tevent_context *ev, const char *location)
{
return ev->ops->loop_wait(ev, location);