tevent: add tevent_req_set_cleanup_fn()
authorStefan Metzmacher <metze@samba.org>
Fri, 27 Sep 2013 00:29:57 +0000 (02:29 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 17 Jan 2014 11:38:08 +0000 (12:38 +0100)
commit50b9f154d22f5c356e66bba341e9ee0292218cfd
tree3ead5cfe68d2dad847c8436e7bdd2c9840d78278
parent0ed93e099af833045d9d00b9a8faeb5b93b6ef2e
tevent: add tevent_req_set_cleanup_fn()

Note that some callers used their own destructor for their
tevent_req instance, they'll just overwrite this,
which is not intended, but works without problems.

The intended way is to specify a cleanup function
and handle the TEVENT_REQ_RECEIVED state as destructor.

Note that the TEVENT_REQ_RECEIVED cleanup event might
be triggered by an explicit tevent_req_received()
in the _recv() function. The TEVENT_REQ_RECEIVED event
is only triggered once as tevent_req_received()
will remove the destructor.

So the difference compared to a custom destructor
is that the struct tevent_req itself can continue
to be there, while tevent_req_received() removed
all internal state.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
lib/tevent/tevent.h
lib/tevent/tevent_internal.h
lib/tevent/tevent_req.c