| 153 | } |
| 154 | |
| 155 | static int aeApiAddEvent(aeEventLoop *eventLoop, int fd, int mask) { |
| 156 | aeApiState *state = eventLoop->apidata; |
| 157 | int fullmask, pfd; |
| 158 | |
| 159 | if (evport_debug) |
| 160 | fprintf(stderr, "aeApiAddEvent: fd %d mask 0x%x\n", fd, mask); |
| 161 | |
| 162 | /* |
| 163 | * Since port_associate's "events" argument replaces any existing events, we |
| 164 | * must be sure to include whatever events are already associated when |
| 165 | * we call port_associate() again. |
| 166 | */ |
| 167 | fullmask = mask | eventLoop->events[fd].mask; |
| 168 | pfd = aeApiLookupPending(state, fd); |
| 169 | |
| 170 | if (pfd != -1) { |
| 171 | /* |
| 172 | * This fd was recently returned from aeApiPoll. It should be safe to |
| 173 | * assume that the consumer has processed that poll event, but we play |
| 174 | * it safer by simply updating pending_mask. The fd will be |
| 175 | * re-associated as usual when aeApiPoll is called again. |
| 176 | */ |
| 177 | if (evport_debug) |
| 178 | fprintf(stderr, "aeApiAddEvent: adding to pending fd %d\n", fd); |
| 179 | state->pending_masks[pfd] |= fullmask; |
| 180 | return 0; |
| 181 | } |
| 182 | |
| 183 | return (aeApiAssociate("aeApiAddEvent", state->portfd, fd, fullmask)); |
| 184 | } |
| 185 | |
| 186 | static void aeApiDelEvent(aeEventLoop *eventLoop, int fd, int mask) { |
| 187 | aeApiState *state = eventLoop->apidata; |
nothing calls this directly
no test coverage detected