summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2014-09-18 22:54:23 +0200
committerStefan Metzmacher <metze@samba.org>2015-05-19 16:37:52 +0200
commit4e1cc54c222f6274f28fec39579655b62ab73f2c (patch)
treeed9c36ccfa3664948e0c793a83ccf9124f7b0c50 /source3/lib
parent9ee3422a7097b060592794e8953d1c59f2b6c3c2 (diff)
downloadsamba-4e1cc54c222f6274f28fec39579655b62ab73f2c.tar.gz
s3:tevent_wait: simplify the code by using tevent_req_defer_callback()
This way a user of this could also use tevent_req_error() or wrappers. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Tue May 19 16:37:52 CEST 2015 on sn-devel-104
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/tevent_wait.c27
1 files changed, 3 insertions, 24 deletions
diff --git a/source3/lib/tevent_wait.c b/source3/lib/tevent_wait.c
index 81fb2132519..31bb581d52a 100644
--- a/source3/lib/tevent_wait.c
+++ b/source3/lib/tevent_wait.c
@@ -24,8 +24,7 @@
#include "lib/util/tevent_unix.h"
struct tevent_wait_state {
- struct tevent_immediate *im;
- struct tevent_context *ev;
+ uint8_t _dummy_;
};
struct tevent_req *tevent_wait_send(TALLOC_CTX *mem_ctx,
@@ -38,37 +37,17 @@ struct tevent_req *tevent_wait_send(TALLOC_CTX *mem_ctx,
if (req == NULL) {
return NULL;
}
- state->ev = ev;
- state->im = tevent_create_immediate(state);
- if (tevent_req_nomem(state->im, req)) {
- return tevent_req_post(req, ev);
- }
+
+ tevent_req_defer_callback(req, ev);
return req;
}
-static void tevent_wait_trigger(struct tevent_context *ctx,
- struct tevent_immediate *im,
- void *private_data);
-
void tevent_wait_done(struct tevent_req *req)
{
- struct tevent_wait_state *state;
-
if (req == NULL) {
return;
}
- state = tevent_req_data(req, struct tevent_wait_state);
-
- tevent_schedule_immediate(state->im, state->ev,
- tevent_wait_trigger, req);
-}
-static void tevent_wait_trigger(struct tevent_context *ctx,
- struct tevent_immediate *im,
- void *private_data)
-{
- struct tevent_req *req = talloc_get_type_abort(
- private_data, struct tevent_req);
tevent_req_done(req);
}