summaryrefslogtreecommitdiff
path: root/ot_event.c
diff options
context:
space:
mode:
Diffstat (limited to 'ot_event.c')
-rw-r--r--ot_event.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ot_event.c b/ot_event.c
index 8f55817..61cc07b 100644
--- a/ot_event.c
+++ b/ot_event.c
@@ -40,6 +40,9 @@ static struct epoll_event *g_ready;
40static int g_ready_space; 40static int g_ready_space;
41 41
42const char *event_mechanism(void) { return "epoll"; } 42const char *event_mechanism(void) { return "epoll"; }
43/* The set lives in the kernel, and epoll_ctl during another thread's
44 epoll_wait is what it is for */
45int event_can_share(void) { return 1; }
43 46
44int event_init(void) { 47int event_init(void) {
45 g_ready = NULL; 48 g_ready = NULL;
@@ -118,6 +121,8 @@ static struct kevent *g_ready;
118static int g_ready_space; 121static int g_ready_space;
119 122
120const char *event_mechanism(void) { return "kqueue"; } 123const char *event_mechanism(void) { return "kqueue"; }
124/* The set lives in the kernel, and kevent may be called from any thread */
125int event_can_share(void) { return 1; }
121 126
122int event_init(void) { 127int event_init(void) {
123 g_ready = NULL; 128 g_ready = NULL;
@@ -171,7 +176,7 @@ static int event_change(int fd, int what, uint32_t generation, int deleting) {
171 return 0; 176 return 0;
172} 177}
173 178
174int event_add(int fd, int what, uint32_t generation) { return event_change(fd, what, generation, 0); } 179int event_add(int fd, int what, uint32_t generation) { return what ? event_change(fd, what, generation, 0) : 0; }
175int event_modify(int fd, int what, uint32_t generation) { return event_change(fd, what, generation, 0); } 180int event_modify(int fd, int what, uint32_t generation) { return event_change(fd, what, generation, 0); }
176int event_del(int fd) { return event_change(fd, 0, 0, 1); } 181int event_del(int fd) { return event_change(fd, 0, 0, 1); }
177 182
@@ -229,6 +234,8 @@ static int *g_where;
229static int g_count, g_space, g_where_space; 234static int g_count, g_space, g_where_space;
230 235
231const char *event_mechanism(void) { return "poll"; } 236const char *event_mechanism(void) { return "poll"; }
237/* The arrays below are ours and nothing guards them */
238int event_can_share(void) { return 0; }
232 239
233int event_init(void) { 240int event_init(void) {
234 g_pfds = NULL, g_generation = NULL, g_where = NULL; 241 g_pfds = NULL, g_generation = NULL, g_where = NULL;