summaryrefslogtreecommitdiff
path: root/lib/tevent/tevent_select.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_select.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_select.c')
-rw-r--r--lib/tevent/tevent_select.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/lib/tevent/tevent_select.c b/lib/tevent/tevent_select.c
index 1c295d7ca4..d97418991a 100644
--- a/lib/tevent/tevent_select.c
+++ b/lib/tevent/tevent_select.c
@@ -210,8 +210,13 @@ static int select_event_loop_once(struct tevent_context *ev, const char *locatio
struct select_event_context);
struct timeval tval;
- if (select_ev->ev->signal_events &&
- tevent_common_check_signal(select_ev->ev)) {
+ if (ev->signal_events &&
+ tevent_common_check_signal(ev)) {
+ return 0;
+ }
+
+ if (ev->immediate_events &&
+ tevent_common_loop_immediate(ev)) {
return 0;
}
@@ -224,15 +229,16 @@ static int select_event_loop_once(struct tevent_context *ev, const char *locatio
}
static const struct tevent_ops select_event_ops = {
- .context_init = select_event_context_init,
- .add_fd = select_event_add_fd,
- .set_fd_close_fn= tevent_common_fd_set_close_fn,
- .get_fd_flags = tevent_common_fd_get_flags,
- .set_fd_flags = tevent_common_fd_set_flags,
- .add_timer = tevent_common_add_timer,
- .add_signal = tevent_common_add_signal,
- .loop_once = select_event_loop_once,
- .loop_wait = tevent_common_loop_wait,
+ .context_init = select_event_context_init,
+ .add_fd = select_event_add_fd,
+ .set_fd_close_fn = tevent_common_fd_set_close_fn,
+ .get_fd_flags = tevent_common_fd_get_flags,
+ .set_fd_flags = tevent_common_fd_set_flags,
+ .add_timer = tevent_common_add_timer,
+ .schedule_immediate = tevent_common_schedule_immediate,
+ .add_signal = tevent_common_add_signal,
+ .loop_once = select_event_loop_once,
+ .loop_wait = tevent_common_loop_wait,
};
bool tevent_select_init(void)