… | |
… | |
766 | unsigned char o_reify = anfd->reify; |
766 | unsigned char o_reify = anfd->reify; |
767 | |
767 | |
768 | anfd->reify = 0; |
768 | anfd->reify = 0; |
769 | anfd->events = events; |
769 | anfd->events = events; |
770 | |
770 | |
771 | if (o_events != events || o_reify & EV_IOFDSET) |
771 | if (o_events != events || o_reify & EV__IOFDSET) |
772 | backend_modify (EV_A_ fd, o_events, events); |
772 | backend_modify (EV_A_ fd, o_events, events); |
773 | } |
773 | } |
774 | } |
774 | } |
775 | |
775 | |
776 | fdchangecnt = 0; |
776 | fdchangecnt = 0; |
… | |
… | |
847 | for (fd = 0; fd < anfdmax; ++fd) |
847 | for (fd = 0; fd < anfdmax; ++fd) |
848 | if (anfds [fd].events) |
848 | if (anfds [fd].events) |
849 | { |
849 | { |
850 | anfds [fd].events = 0; |
850 | anfds [fd].events = 0; |
851 | anfds [fd].emask = 0; |
851 | anfds [fd].emask = 0; |
852 | fd_change (EV_A_ fd, EV_IOFDSET | 1); |
852 | fd_change (EV_A_ fd, EV__IOFDSET | 1); |
853 | } |
853 | } |
854 | } |
854 | } |
855 | |
855 | |
856 | /*****************************************************************************/ |
856 | /*****************************************************************************/ |
857 | |
857 | |
… | |
… | |
2174 | |
2174 | |
2175 | if (expect_false (ev_is_active (w))) |
2175 | if (expect_false (ev_is_active (w))) |
2176 | return; |
2176 | return; |
2177 | |
2177 | |
2178 | assert (("libev: ev_io_start called with negative fd", fd >= 0)); |
2178 | assert (("libev: ev_io_start called with negative fd", fd >= 0)); |
2179 | assert (("libev: ev_io start called with illegal event mask", !(w->events & ~(EV_IOFDSET | EV_READ | EV_WRITE)))); |
2179 | assert (("libev: ev_io start called with illegal event mask", !(w->events & ~(EV__IOFDSET | EV_READ | EV_WRITE)))); |
2180 | |
2180 | |
2181 | EV_FREQUENT_CHECK; |
2181 | EV_FREQUENT_CHECK; |
2182 | |
2182 | |
2183 | ev_start (EV_A_ (W)w, 1); |
2183 | ev_start (EV_A_ (W)w, 1); |
2184 | array_needsize (ANFD, anfds, anfdmax, fd + 1, array_init_zero); |
2184 | array_needsize (ANFD, anfds, anfdmax, fd + 1, array_init_zero); |
2185 | wlist_add (&anfds[fd].head, (WL)w); |
2185 | wlist_add (&anfds[fd].head, (WL)w); |
2186 | |
2186 | |
2187 | fd_change (EV_A_ fd, w->events & EV_IOFDSET | 1); |
2187 | fd_change (EV_A_ fd, w->events & EV__IOFDSET | 1); |
2188 | w->events &= ~EV_IOFDSET; |
2188 | w->events &= ~EV__IOFDSET; |
2189 | |
2189 | |
2190 | EV_FREQUENT_CHECK; |
2190 | EV_FREQUENT_CHECK; |
2191 | } |
2191 | } |
2192 | |
2192 | |
2193 | void noinline |
2193 | void noinline |
… | |
… | |
3146 | ev_timer_set (&once->to, timeout, 0.); |
3146 | ev_timer_set (&once->to, timeout, 0.); |
3147 | ev_timer_start (EV_A_ &once->to); |
3147 | ev_timer_start (EV_A_ &once->to); |
3148 | } |
3148 | } |
3149 | } |
3149 | } |
3150 | |
3150 | |
|
|
3151 | /*****************************************************************************/ |
|
|
3152 | |
|
|
3153 | #if 0 |
|
|
3154 | void |
|
|
3155 | ev_walk (EV_P_ int types, void (*cb)(EV_P_ int type, void *w)) |
|
|
3156 | { |
|
|
3157 | int i, j; |
|
|
3158 | ev_watcher_list *wl, *wn; |
|
|
3159 | |
|
|
3160 | if (types & (EV_IO | EV_EMBED)) |
|
|
3161 | for (i = 0; i < anfdmax; ++i) |
|
|
3162 | for (wl = anfds [i].head; wl; ) |
|
|
3163 | { |
|
|
3164 | wn = wl->next; |
|
|
3165 | |
|
|
3166 | #if EV_EMBED_ENABLE |
|
|
3167 | if (ev_cb ((ev_io *)wl) == embed_io_cb) |
|
|
3168 | { |
|
|
3169 | if (types & EV_EMBED) |
|
|
3170 | cb (EV_A_ EV_EMBED, ((char *)wl) - offsetof (struct ev_embed, io)); |
|
|
3171 | } |
|
|
3172 | else |
|
|
3173 | #endif |
|
|
3174 | #if EV_USE_INOTIFY |
|
|
3175 | if (ev_cb ((ev_io *)wl) == infy_cb) |
|
|
3176 | ; |
|
|
3177 | else |
|
|
3178 | #endif |
|
|
3179 | if ((ev_io *)wl != &pipeev) |
|
|
3180 | if (types & EV_IO) |
|
|
3181 | cb (EV_A_ EV_IO, wl); |
|
|
3182 | |
|
|
3183 | wl = wn; |
|
|
3184 | } |
|
|
3185 | |
|
|
3186 | if (types & (EV_TIMER | EV_STAT)) |
|
|
3187 | for (i = timercnt + HEAP0; i-- > HEAP0; ) |
|
|
3188 | #if EV_STAT_ENABLE |
|
|
3189 | /*TODO: timer is not always active*/ |
|
|
3190 | if (ev_cb ((ev_timer *)ANHE_w (timers [i])) == stat_timer_cb) |
|
|
3191 | { |
|
|
3192 | if (types & EV_STAT) |
|
|
3193 | cb (EV_A_ EV_STAT, ((char *)ANHE_w (timers [i])) - offsetof (struct ev_stat, timer)); |
|
|
3194 | } |
|
|
3195 | else |
|
|
3196 | #endif |
|
|
3197 | if (types & EV_TIMER) |
|
|
3198 | cb (EV_A_ EV_TIMER, ANHE_w (timers [i])); |
|
|
3199 | |
|
|
3200 | #if EV_PERIODIC_ENABLE |
|
|
3201 | if (types & EV_PERIODIC) |
|
|
3202 | for (i = periodiccnt + HEAP0; i-- > HEAP0; ) |
|
|
3203 | cb (EV_A_ EV_PERIODIC, ANHE_w (periodics [i])); |
|
|
3204 | #endif |
|
|
3205 | |
|
|
3206 | #if EV_IDLE_ENABLE |
|
|
3207 | if (types & EV_IDLE) |
|
|
3208 | for (j = NUMPRI; i--; ) |
|
|
3209 | for (i = idlecnt [j]; i--; ) |
|
|
3210 | cb (EV_A_ EV_IDLE, idles [j][i]); |
|
|
3211 | #endif |
|
|
3212 | |
|
|
3213 | #if EV_FORK_ENABLE |
|
|
3214 | if (types & EV_FORK) |
|
|
3215 | for (i = forkcnt; i--; ) |
|
|
3216 | if (ev_cb (forks [i]) != embed_fork_cb) |
|
|
3217 | cb (EV_A_ EV_FORK, forks [i]); |
|
|
3218 | #endif |
|
|
3219 | |
|
|
3220 | #if EV_ASYNC_ENABLE |
|
|
3221 | if (types & EV_ASYNC) |
|
|
3222 | for (i = asynccnt; i--; ) |
|
|
3223 | cb (EV_A_ EV_ASYNC, asyncs [i]); |
|
|
3224 | #endif |
|
|
3225 | |
|
|
3226 | if (types & EV_PREPARE) |
|
|
3227 | for (i = preparecnt; i--; ) |
|
|
3228 | #if EV_EMBED_ENABLE |
|
|
3229 | if (ev_cb (prepares [i]) != embed_prepare_cb) |
|
|
3230 | #endif |
|
|
3231 | cb (EV_A_ EV_PREPARE, prepares [i]); |
|
|
3232 | |
|
|
3233 | if (types & EV_CHECK) |
|
|
3234 | for (i = checkcnt; i--; ) |
|
|
3235 | cb (EV_A_ EV_CHECK, checks [i]); |
|
|
3236 | |
|
|
3237 | if (types & EV_SIGNAL) |
|
|
3238 | for (i = 0; i < signalmax; ++i) |
|
|
3239 | for (wl = signals [i].head; wl; ) |
|
|
3240 | { |
|
|
3241 | wn = wl->next; |
|
|
3242 | cb (EV_A_ EV_SIGNAL, wl); |
|
|
3243 | wl = wn; |
|
|
3244 | } |
|
|
3245 | |
|
|
3246 | if (types & EV_CHILD) |
|
|
3247 | for (i = EV_PID_HASHSIZE; i--; ) |
|
|
3248 | for (wl = childs [i]; wl; ) |
|
|
3249 | { |
|
|
3250 | wn = wl->next; |
|
|
3251 | cb (EV_A_ EV_CHILD, wl); |
|
|
3252 | wl = wn; |
|
|
3253 | } |
|
|
3254 | /* EV_STAT 0x00001000 /* stat data changed */ |
|
|
3255 | /* EV_EMBED 0x00010000 /* embedded event loop needs sweep */ |
|
|
3256 | } |
|
|
3257 | #endif |
|
|
3258 | |
3151 | #if EV_MULTIPLICITY |
3259 | #if EV_MULTIPLICITY |
3152 | #include "ev_wrap.h" |
3260 | #include "ev_wrap.h" |
3153 | #endif |
3261 | #endif |
3154 | |
3262 | |
3155 | #ifdef __cplusplus |
3263 | #ifdef __cplusplus |