1 | /* |
1 | /* |
2 | * libev epoll fd activity backend |
2 | * libev poll fd activity backend |
3 | * |
3 | * |
4 | * Copyright (c) 2007 Marc Alexander Lehmann <libev@schmorp.de> |
4 | * Copyright (c) 2007 Marc Alexander Lehmann <libev@schmorp.de> |
5 | * All rights reserved. |
5 | * All rights reserved. |
6 | * |
6 | * |
7 | * Redistribution and use in source and binary forms, with or without |
7 | * Redistribution and use in source and binary forms, with or without |
… | |
… | |
103 | (polls [i].revents & (POLLOUT | POLLERR | POLLHUP) ? EV_WRITE : 0) |
103 | (polls [i].revents & (POLLOUT | POLLERR | POLLHUP) ? EV_WRITE : 0) |
104 | | (polls [i].revents & (POLLIN | POLLERR | POLLHUP) ? EV_READ : 0) |
104 | | (polls [i].revents & (POLLIN | POLLERR | POLLHUP) ? EV_READ : 0) |
105 | ); |
105 | ); |
106 | } |
106 | } |
107 | |
107 | |
108 | static int |
108 | int inline_size |
109 | poll_init (EV_P_ int flags) |
109 | poll_init (EV_P_ int flags) |
110 | { |
110 | { |
111 | backend_fudge = 1e-3; /* needed to compensate for select returning early, very conservative */ |
111 | backend_fudge = 1e-3; /* needed to compensate for select returning early, very conservative */ |
112 | backend_modify = poll_modify; |
112 | backend_modify = poll_modify; |
113 | backend_poll = poll_poll; |
113 | backend_poll = poll_poll; |
… | |
… | |
116 | polls = 0; pollmax = 0; pollcnt = 0; |
116 | polls = 0; pollmax = 0; pollcnt = 0; |
117 | |
117 | |
118 | return EVBACKEND_POLL; |
118 | return EVBACKEND_POLL; |
119 | } |
119 | } |
120 | |
120 | |
121 | static void |
121 | void inline_size |
122 | poll_destroy (EV_P) |
122 | poll_destroy (EV_P) |
123 | { |
123 | { |
124 | ev_free (pollidxs); |
124 | ev_free (pollidxs); |
125 | ev_free (polls); |
125 | ev_free (polls); |
126 | } |
126 | } |