2 Unix SMB/CIFS implementation.
3 Infrastructure for async requests
4 Copyright (C) Volker Lendecke 2008
5 Copyright (C) Stefan Metzmacher 2009
7 ** NOTE! The following LGPL license applies to the tevent
8 ** library. This does NOT imply that all of Samba is released
11 This library is free software; you can redistribute it and/or
12 modify it under the terms of the GNU Lesser General Public
13 License as published by the Free Software Foundation; either
14 version 3 of the License, or (at your option) any later version.
16 This library is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
21 You should have received a copy of the GNU Lesser General Public
22 License along with this library; if not, see <http://www.gnu.org/licenses/>.
25 /* Back-port of missing API from 4.2.x for tevent_queues. */
29 #include "source3/lib/smbd_tevent_queue.h"
31 struct tevent_queue_wait_state
{
35 static void tevent_queue_wait_trigger(struct tevent_req
*req
,
38 struct tevent_req
*smbd_tevent_queue_wait_send(TALLOC_CTX
*mem_ctx
,
39 struct tevent_context
*ev
,
40 struct tevent_queue
*queue
)
42 struct tevent_req
*req
;
43 struct tevent_queue_wait_state
*state
;
46 req
= tevent_req_create(mem_ctx
, &state
,
47 struct tevent_queue_wait_state
);
52 ok
= tevent_queue_add(queue
, ev
, req
,
53 tevent_queue_wait_trigger
,
57 return tevent_req_post(req
, ev
);
63 static void tevent_queue_wait_trigger(struct tevent_req
*req
,
69 bool smbd_tevent_queue_wait_recv(struct tevent_req
*req
)
71 enum tevent_req_state state
;
74 if (tevent_req_is_error(req
, &state
, &err
)) {
75 tevent_req_received(req
);
79 tevent_req_received(req
);