summaryrefslogtreecommitdiff
path: root/lib/tevent/tevent_queue.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-08-09 15:33:37 +0200
committerStefan Metzmacher <metze@samba.org>2011-08-09 21:37:41 +0200
commit6b7d58cb4ee3ed7796a8dc67c214a1b8439fbaeb (patch)
treea276257a9313b61707890d8f4c0b7e2032650565 /lib/tevent/tevent_queue.c
parentaba9d48f55b7e69af0967d0f435843c833357ec7 (diff)
downloadsamba-6b7d58cb4ee3ed7796a8dc67c214a1b8439fbaeb.tar.gz
samba-6b7d58cb4ee3ed7796a8dc67c214a1b8439fbaeb.tar.bz2
samba-6b7d58cb4ee3ed7796a8dc67c214a1b8439fbaeb.zip
tevent: splitout tevent_queue_add_internal() from tevent_queue_add()
metze
Diffstat (limited to 'lib/tevent/tevent_queue.c')
-rw-r--r--lib/tevent/tevent_queue.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/lib/tevent/tevent_queue.c b/lib/tevent/tevent_queue.c
index 3fca7fb948..7737b3e814 100644
--- a/lib/tevent/tevent_queue.c
+++ b/lib/tevent/tevent_queue.c
@@ -144,17 +144,18 @@ static void tevent_queue_immediate_trigger(struct tevent_context *ev,
q->list->trigger(q->list->req, q->list->private_data);
}
-bool tevent_queue_add(struct tevent_queue *queue,
- struct tevent_context *ev,
- struct tevent_req *req,
- tevent_queue_trigger_fn_t trigger,
- void *private_data)
+static struct tevent_queue_entry *tevent_queue_add_internal(
+ struct tevent_queue *queue,
+ struct tevent_context *ev,
+ struct tevent_req *req,
+ tevent_queue_trigger_fn_t trigger,
+ void *private_data)
{
struct tevent_queue_entry *e;
e = talloc_zero(req, struct tevent_queue_entry);
if (e == NULL) {
- return false;
+ return NULL;
}
e->queue = queue;
@@ -175,11 +176,11 @@ bool tevent_queue_add(struct tevent_queue *queue,
talloc_set_destructor(e, tevent_queue_entry_destructor);
if (!queue->running) {
- return true;
+ return e;
}
if (queue->list->triggered) {
- return true;
+ return e;
}
tevent_schedule_immediate(queue->immediate,
@@ -187,6 +188,23 @@ bool tevent_queue_add(struct tevent_queue *queue,
tevent_queue_immediate_trigger,
queue);
+ return e;
+}
+
+bool tevent_queue_add(struct tevent_queue *queue,
+ struct tevent_context *ev,
+ struct tevent_req *req,
+ tevent_queue_trigger_fn_t trigger,
+ void *private_data)
+{
+ struct tevent_queue_entry *e;
+
+ e = tevent_queue_add_internal(queue, ev, req,
+ trigger, private_data);
+ if (e == NULL) {
+ return false;
+ }
+
return true;
}