summaryrefslogtreecommitdiff
path: root/source4/lib/events/events_select.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2007-01-21 08:23:14 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:43:54 -0500
commit336ae458e9f648625f8fe438bf1dc4c8f7e616a7 (patch)
treedd7ead16ed385381a13046a85f2ff2a431465480 /source4/lib/events/events_select.c
parent7fba2dbf9a7b387fb5a975b528d880da55da1560 (diff)
downloadsamba-336ae458e9f648625f8fe438bf1dc4c8f7e616a7.tar.gz
samba-336ae458e9f648625f8fe438bf1dc4c8f7e616a7.tar.bz2
samba-336ae458e9f648625f8fe438bf1dc4c8f7e616a7.zip
r20928: added signal events to lib/events
Jeremy asked for this to allow Samba3 to use the Samba4 events library see torture/local/event.c for an example (This used to be commit 7e105482ff9a3da6b4708ff99a64f1881614fc5f)
Diffstat (limited to 'source4/lib/events/events_select.c')
-rw-r--r--source4/lib/events/events_select.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source4/lib/events/events_select.c b/source4/lib/events/events_select.c
index 5f4ecba5ca..ea84353183 100644
--- a/source4/lib/events/events_select.c
+++ b/source4/lib/events/events_select.c
@@ -197,8 +197,19 @@ static int select_event_loop_select(struct select_event_context *select_ev, stru
}
}
+ if (select_ev->ev->num_signal_handlers &&
+ common_event_check_signal(select_ev->ev)) {
+ return 0;
+ }
+
selrtn = select(select_ev->maxfd+1, &r_fds, &w_fds, NULL, tvalp);
+ if (selrtn == -1 && errno == EINTR &&
+ select_ev->ev->num_signal_handlers) {
+ common_event_check_signal(select_ev->ev);
+ return 0;
+ }
+
if (selrtn == -1 && errno == EBADF) {
/* the socket is dead! this should never
happen as the socket should have first been
@@ -279,6 +290,7 @@ static const struct event_ops select_event_ops = {
.get_fd_flags = select_event_get_fd_flags,
.set_fd_flags = select_event_set_fd_flags,
.add_timed = common_event_add_timed,
+ .add_signal = common_event_add_signal,
.loop_once = select_event_loop_once,
.loop_wait = select_event_loop_wait,
};