diff options
Diffstat (limited to 'ot_event.c')
| -rw-r--r-- | ot_event.c | 9 |
1 files changed, 8 insertions, 1 deletions
| @@ -40,6 +40,9 @@ static struct epoll_event *g_ready; | |||
| 40 | static int g_ready_space; | 40 | static int g_ready_space; |
| 41 | 41 | ||
| 42 | const char *event_mechanism(void) { return "epoll"; } | 42 | const 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 */ | ||
| 45 | int event_can_share(void) { return 1; } | ||
| 43 | 46 | ||
| 44 | int event_init(void) { | 47 | int event_init(void) { |
| 45 | g_ready = NULL; | 48 | g_ready = NULL; |
| @@ -118,6 +121,8 @@ static struct kevent *g_ready; | |||
| 118 | static int g_ready_space; | 121 | static int g_ready_space; |
| 119 | 122 | ||
| 120 | const char *event_mechanism(void) { return "kqueue"; } | 123 | const char *event_mechanism(void) { return "kqueue"; } |
| 124 | /* The set lives in the kernel, and kevent may be called from any thread */ | ||
| 125 | int event_can_share(void) { return 1; } | ||
| 121 | 126 | ||
| 122 | int event_init(void) { | 127 | int 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 | ||
| 174 | int event_add(int fd, int what, uint32_t generation) { return event_change(fd, what, generation, 0); } | 179 | int event_add(int fd, int what, uint32_t generation) { return what ? event_change(fd, what, generation, 0) : 0; } |
| 175 | int event_modify(int fd, int what, uint32_t generation) { return event_change(fd, what, generation, 0); } | 180 | int event_modify(int fd, int what, uint32_t generation) { return event_change(fd, what, generation, 0); } |
| 176 | int event_del(int fd) { return event_change(fd, 0, 0, 1); } | 181 | int event_del(int fd) { return event_change(fd, 0, 0, 1); } |
| 177 | 182 | ||
| @@ -229,6 +234,8 @@ static int *g_where; | |||
| 229 | static int g_count, g_space, g_where_space; | 234 | static int g_count, g_space, g_where_space; |
| 230 | 235 | ||
| 231 | const char *event_mechanism(void) { return "poll"; } | 236 | const char *event_mechanism(void) { return "poll"; } |
| 237 | /* The arrays below are ours and nothing guards them */ | ||
| 238 | int event_can_share(void) { return 0; } | ||
| 232 | 239 | ||
| 233 | int event_init(void) { | 240 | int event_init(void) { |
| 234 | g_pfds = NULL, g_generation = NULL, g_where = NULL; | 241 | g_pfds = NULL, g_generation = NULL, g_where = NULL; |
