From b213b70c089046f426e1e3f2f733e42a02e2cbfe Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 5 Jan 2007 09:35:49 +0000 Subject: r20539: - split the common timer related events code into events_timed.c - make it easier to plug in a new events backend - add simpler 'select' and 'epoll' backends This is part of the effort to add good AIO support. The events_aio.c backend is done, but sometimes dies with a SEGV, which is why it isn't enabled yet. (This used to be commit 934f18283dbc7958944931a93a854526bcd54884) --- source4/lib/events/events_internal.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'source4/lib/events/events_internal.h') diff --git a/source4/lib/events/events_internal.h b/source4/lib/events/events_internal.h index de4e5f6a5a..dc321769e0 100644 --- a/source4/lib/events/events_internal.h +++ b/source4/lib/events/events_internal.h @@ -24,7 +24,7 @@ struct event_ops { /* conntext init */ - int (*context_init)(struct event_context *ev, void *private_data); + int (*context_init)(struct event_context *ev); /* fd_event functions */ struct fd_event *(*add_fd)(struct event_context *ev, @@ -41,6 +41,12 @@ struct event_ops { struct timeval next_event, event_timed_handler_t handler, void *private_data); + /* disk aio event functions */ + struct aio_event *(*add_aio)(struct event_context *ev, + TALLOC_CTX *mem_ctx, + struct iocb *iocb, + event_aio_handler_t handler, + void *private_data); /* loop functions */ int (*loop_once)(struct event_context *ev); @@ -71,11 +77,24 @@ struct timed_event { void *additional_data; }; +/* aio event is private to the aio backend */ +struct aio_event; + struct event_context { /* the specific events implementation */ const struct event_ops *ops; + + /* list of timed events - used by common code */ + struct timed_event *timed_events; + /* this is private for the events_ops implementation */ void *additional_data; }; -const struct event_ops *event_standard_get_ops(void); + +NTSTATUS event_register_backend(const char *name, const struct event_ops *ops); + +struct timed_event *common_event_add_timed(struct event_context *, TALLOC_CTX *, + struct timeval, event_timed_handler_t, void *); +void common_event_loop_timer(struct event_context *); +struct timeval common_event_loop_delay(struct event_context *); -- cgit