summaryrefslogtreecommitdiff
path: root/lib/tevent/tevent_epoll.c
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_epoll.c
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_epoll.c')
-rw-r--r--lib/tevent/tevent_epoll.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c
index 32544593de..7c7f389d5b 100644
--- a/lib/tevent/tevent_epoll.c
+++ b/lib/tevent/tevent_epoll.c
@@ -404,8 +404,13 @@ static int epoll_event_loop_once(struct tevent_context *ev, const char *location
struct epoll_event_context);
struct timeval tval;
- if (epoll_ev->ev->signal_events &&
- tevent_common_check_signal(epoll_ev->ev)) {
+ if (ev->signal_events &&
+ tevent_common_check_signal(ev)) {
+ return 0;
+ }
+
+ if (ev->immediate_events &&
+ tevent_common_loop_immediate(ev)) {
return 0;
}
@@ -420,15 +425,16 @@ static int epoll_event_loop_once(struct tevent_context *ev, const char *location
}
static const struct tevent_ops epoll_event_ops = {
- .context_init = epoll_event_context_init,
- .add_fd = epoll_event_add_fd,
- .set_fd_close_fn= tevent_common_fd_set_close_fn,
- .get_fd_flags = tevent_common_fd_get_flags,
- .set_fd_flags = epoll_event_set_fd_flags,
- .add_timer = tevent_common_add_timer,
- .add_signal = tevent_common_add_signal,
- .loop_once = epoll_event_loop_once,
- .loop_wait = tevent_common_loop_wait,
+ .context_init = epoll_event_context_init,
+ .add_fd = epoll_event_add_fd,
+ .set_fd_close_fn = tevent_common_fd_set_close_fn,
+ .get_fd_flags = tevent_common_fd_get_flags,
+ .set_fd_flags = epoll_event_set_fd_flags,
+ .add_timer = tevent_common_add_timer,
+ .schedule_immediate = tevent_common_schedule_immediate,
+ .add_signal = tevent_common_add_signal,
+ .loop_once = epoll_event_loop_once,
+ .loop_wait = tevent_common_loop_wait,
};
bool tevent_epoll_init(void)