… | |
… | |
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 |