summaryrefslogtreecommitdiff
path: root/lib/tevent/tevent_internal.h
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-03-13 15:47:33 +0100
committerStefan Metzmacher <metze@samba.org>2009-03-17 19:59:00 +0100
commit66886f8966dff8a980a5b9d2daa3fbb20fe5ca8e (patch)
tree383df98ac1fc50173ea09e0496eff2040185aeec /lib/tevent/tevent_internal.h
parentd27be1d5fa3fdcaac07b527ad14b0d10ef27c0bb (diff)
downloadsamba-66886f8966dff8a980a5b9d2daa3fbb20fe5ca8e.tar.gz
samba-66886f8966dff8a980a5b9d2daa3fbb20fe5ca8e.tar.bz2
samba-66886f8966dff8a980a5b9d2daa3fbb20fe5ca8e.zip
tevent: add support for immediate events
They're like directly triggered timed events, but you can preallocated them and scheduling them will not fail. metze
Diffstat (limited to 'lib/tevent/tevent_internal.h')
-rw-r--r--lib/tevent/tevent_internal.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/tevent/tevent_internal.h b/lib/tevent/tevent_internal.h
index f63a58aadd..cf54242da1 100644
--- a/lib/tevent/tevent_internal.h
+++ b/lib/tevent/tevent_internal.h
@@ -143,6 +143,15 @@ struct tevent_ops {
void *private_data,
const char *handler_name,
const char *location);
+
+ /* immediate event functions */
+ void (*schedule_immediate)(struct tevent_immediate *im,
+ struct tevent_context *ev,
+ tevent_immediate_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location);
+
/* signal functions */
struct tevent_signal *(*add_signal)(struct tevent_context *ev,
TALLOC_CTX *mem_ctx,
@@ -188,6 +197,21 @@ struct tevent_timer {
void *additional_data;
};
+struct tevent_immediate {
+ struct tevent_immediate *prev, *next;
+ struct tevent_context *event_ctx;
+ tevent_immediate_handler_t handler;
+ /* this is private for the specific handler */
+ void *private_data;
+ /* this is for debugging only! */
+ const char *handler_name;
+ const char *create_location;
+ const char *schedule_location;
+ /* this is private for the events_ops implementation */
+ void (*cancel_fn)(struct tevent_immediate *im);
+ void *additional_data;
+};
+
struct tevent_signal {
struct tevent_signal *prev, *next;
struct tevent_context *event_ctx;
@@ -222,6 +246,9 @@ struct tevent_context {
/* list of timed events - used by common code */
struct tevent_timer *timer_events;
+ /* list of immediate events - used by common code */
+ struct tevent_immediate *immediate_events;
+
/* list of signal events - used by common code */
struct tevent_signal *signal_events;
@@ -273,6 +300,14 @@ struct tevent_timer *tevent_common_add_timer(struct tevent_context *ev,
const char *location);
struct timeval tevent_common_loop_timer_delay(struct tevent_context *);
+void tevent_common_schedule_immediate(struct tevent_immediate *im,
+ struct tevent_context *ev,
+ tevent_immediate_handler_t handler,
+ void *private_data,
+ const char *handler_name,
+ const char *location);
+bool tevent_common_loop_immediate(struct tevent_context *ev);
+
struct tevent_signal *tevent_common_add_signal(struct tevent_context *ev,
TALLOC_CTX *mem_ctx,
int signum,