X-Git-Url: http://git.samba.org/samba.git/?a=blobdiff_plain;f=lib%2Ftevent%2Ftevent.c;fp=lib%2Ftevent%2Ftevent.c;h=ceae534c9bf905393a9805e106681167c8017b99;hb=5609c504337b79fd6f521c42b414c650b23d0c9a;hp=a0ee208663880d0429de3744a2b8c951e6ed183f;hpb=525a4fb2c423dbbeeb1e6da3254f334044b7bd7f;p=ira%2Fwip.git diff --git a/lib/tevent/tevent.c b/lib/tevent/tevent.c index a0ee2086638..ceae534c9bf 100644 --- a/lib/tevent/tevent.c +++ b/lib/tevent/tevent.c @@ -616,3 +616,18 @@ int _tevent_loop_wait(struct tevent_context *ev, const char *location) { return ev->ops->loop_wait(ev, location); } + + +/* + re-initialise a tevent context. This leaves you with the same + event context, but all events are wiped and the structure is + re-initialised. This is most useful after a fork() + + zero is returned on success, non-zero on failure +*/ +int tevent_re_initialise(struct tevent_context *ev) +{ + tevent_common_context_destructor(ev); + + return ev->ops->context_init(ev); +}