summaryrefslogtreecommitdiffstats
path: root/lib/tevent/tevent.h
diff options
context:
space:
mode:
authorGregor Beck <gbeck@sernet.de>2013-09-19 15:14:25 +0200
committerStefan Metzmacher <metze@samba.org>2013-12-11 22:46:09 +0100
commit8e44c2f96397a4f8cf945bcc810e3a1776d86a08 (patch)
tree642f1f2c122e49c306d1b2ccafa9fc53859371a5 /lib/tevent/tevent.h
parent7a97d4c4c36d27e2c0732d70345d1766a4a86e94 (diff)
downloadsamba-8e44c2f96397a4f8cf945bcc810e3a1776d86a08.tar.gz
samba-8e44c2f96397a4f8cf945bcc810e3a1776d86a08.tar.xz
samba-8e44c2f96397a4f8cf945bcc810e3a1776d86a08.zip
tevent: add tevent_queue_wait_send/recv()
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Gregor Beck <gbeck@sernet.de> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
Diffstat (limited to 'lib/tevent/tevent.h')
-rw-r--r--lib/tevent/tevent.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/lib/tevent/tevent.h b/lib/tevent/tevent.h
index 2bc4e2d7ad7..0705ff30bd4 100644
--- a/lib/tevent/tevent.h
+++ b/lib/tevent/tevent.h
@@ -1592,6 +1592,39 @@ size_t tevent_queue_length(struct tevent_queue *queue);
*/
bool tevent_queue_running(struct tevent_queue *queue);
+/**
+ * @brief Create a tevent subrequest that waits in a tevent_queue
+ *
+ * The idea is that always the same syntax for tevent requests.
+ *
+ * @param[in] mem_ctx The talloc memory context to use.
+ *
+ * @param[in] ev The event handle to setup the request.
+ *
+ * @param[in] queue The queue to wait in.
+ *
+ * @return The new subrequest, NULL on error.
+ *
+ * @see tevent_queue_wait_recv()
+ */
+struct tevent_req *tevent_queue_wait_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct tevent_queue *queue);
+
+/**
+ * @brief Check if we no longer need to wait in the queue.
+ *
+ * This function needs to be called in the callback function set after calling
+ * tevent_queue_wait_send().
+ *
+ * @param[in] req The tevent request to check.
+ *
+ * @return True on success, false otherwise.
+ *
+ * @see tevent_queue_wait_send()
+ */
+bool tevent_queue_wait_recv(struct tevent_req *req);
+
typedef int (*tevent_nesting_hook)(struct tevent_context *ev,
void *private_data,
uint32_t level,