summaryrefslogtreecommitdiff
path: root/lib/tevent
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-02-25 13:53:19 +0100
committerStefan Metzmacher <metze@samba.org>2009-02-25 14:08:36 +0100
commit13ac0dc4565b1cbdb977b6959562f3f8f9ac5ff8 (patch)
tree476255815203170285e24b53122bcd464e292057 /lib/tevent
parent5bab95b58366ff001b4967bdb0674f42dc990a77 (diff)
downloadsamba-13ac0dc4565b1cbdb977b6959562f3f8f9ac5ff8.tar.gz
samba-13ac0dc4565b1cbdb977b6959562f3f8f9ac5ff8.tar.bz2
samba-13ac0dc4565b1cbdb977b6959562f3f8f9ac5ff8.zip
tevent: add tevent_req_poll() function
metze
Diffstat (limited to 'lib/tevent')
-rw-r--r--lib/tevent/tevent.h3
-rw-r--r--lib/tevent/tevent_req.c15
2 files changed, 18 insertions, 0 deletions
diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h
index b3d1c6d59a..b3611228aa 100644
--- a/lib/tevent/tevent.h
+++ b/lib/tevent/tevent.h
@@ -296,6 +296,9 @@ struct tevent_req *tevent_req_post(struct tevent_req *req,
bool tevent_req_is_in_progress(struct tevent_req *req);
+bool tevent_req_poll(struct tevent_req *req,
+ struct tevent_context *ev);
+
bool tevent_req_is_error(struct tevent_req *req,
enum tevent_req_state *state,
uint64_t *error);
diff --git a/lib/tevent/tevent_req.c b/lib/tevent/tevent_req.c
index 800e3855d1..c17587b16c 100644
--- a/lib/tevent/tevent_req.c
+++ b/lib/tevent/tevent_req.c
@@ -235,6 +235,21 @@ bool tevent_req_is_in_progress(struct tevent_req *req)
return false;
}
+bool tevent_req_poll(struct tevent_req *req,
+ struct tevent_context *ev)
+{
+ while (tevent_req_is_in_progress(req)) {
+ int ret;
+
+ ret = tevent_loop_once(ev);
+ if (ret != 0) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
bool tevent_req_is_error(struct tevent_req *req, enum tevent_req_state *state,
uint64_t *error)
{