2 Unix SMB/CIFS implementation.
4 Coroutine abstraction for tevent.
6 Copyright (C) Stefan Metzmacher 2009
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #ifndef _TEVENT_COROUTINE_H_
23 #define _TEVENT_COROUTINE_H_
25 struct tevent_coroutine;
26 struct tevent_coroutine_result;
28 typedef struct tevent_coroutine_result *(*tevent_coroutine_fn_t)(
29 struct tevent_coroutine *co,
30 struct tevent_context *ev,
33 struct tevent_coroutine *_tevent_coroutine_create(
34 struct tevent_req *req,
35 struct tevent_context *ev,
36 tevent_coroutine_fn_t fn,
37 const char *location);
38 #define tevent_coroutine_create(req, ev, fn) \
39 _tevent_coroutine_create(req, ev, fn, __location__)
41 bool _tevent_coroutine_yield(struct tevent_coroutine *tco,
42 struct tevent_req *subreq,
43 const char *location);
44 #define tevent_coroutine_yield(tco, subreq) \
45 _tevent_coroutine_yield(tco, subreq, __location__)
47 void _tevent_coroutine_done(struct tevent_coroutine *tco,
48 const char *location);
49 #define tevent_coroutine_done(tco) \
50 _tevent_coroutine_done(tco, __location__) \
52 bool _tevent_coroutine_nomem(const void *ptr,
53 struct tevent_coroutine *tco,
54 const char *location);
55 #define tevent_coroutine_nomem(ptr, tco) \
56 _tevent_coroutine_nomem(ptr, tco, __location__)
58 bool _tevent_coroutine_error(struct tevent_coroutine *tco,
60 const char *location);
61 #define tevent_coroutine_error(tco, error) \
62 _tevent_coroutine_error(tco, error, __location__)
64 struct tevent_coroutine_result *_tevent_coroutine_return(
65 struct tevent_coroutine *tco,
66 const char *location);
67 #define tevent_coroutine_return(tco) \
68 _tevent_coroutine_return(tco, __location__)
70 #endif /* _TEVENT_COROUTINE_H_ */