… | |
… | |
191 | { |
191 | { |
192 | ev_timer_again (EV_A_ static_cast<ev_timer *>(this)); |
192 | ev_timer_again (EV_A_ static_cast<ev_timer *>(this)); |
193 | } |
193 | } |
194 | EV_END_WATCHER (timer, timer) |
194 | EV_END_WATCHER (timer, timer) |
195 | |
195 | |
196 | #if EV_PERIODICS |
196 | #if EV_PERIODIC_ENABLE |
197 | EV_BEGIN_WATCHER (periodic, periodic) |
197 | EV_BEGIN_WATCHER (periodic, periodic) |
198 | void set (ev_tstamp at, ev_tstamp interval = 0.) |
198 | void set (ev_tstamp at, ev_tstamp interval = 0.) |
199 | { |
199 | { |
200 | int active = is_active (); |
200 | int active = is_active (); |
201 | if (active) stop (); |
201 | if (active) stop (); |
… | |
… | |
212 | void again () |
212 | void again () |
213 | { |
213 | { |
214 | ev_periodic_again (EV_A_ static_cast<ev_periodic *>(this)); |
214 | ev_periodic_again (EV_A_ static_cast<ev_periodic *>(this)); |
215 | } |
215 | } |
216 | EV_END_WATCHER (periodic, periodic) |
216 | EV_END_WATCHER (periodic, periodic) |
|
|
217 | #endif |
|
|
218 | |
|
|
219 | EV_BEGIN_WATCHER (sig, signal) |
|
|
220 | void set (int signum) |
|
|
221 | { |
|
|
222 | int active = is_active (); |
|
|
223 | if (active) stop (); |
|
|
224 | ev_signal_set (static_cast<ev_signal *>(this), signum); |
|
|
225 | if (active) start (); |
|
|
226 | } |
|
|
227 | |
|
|
228 | void start (int signum) |
|
|
229 | { |
|
|
230 | set (signum); |
|
|
231 | start (); |
|
|
232 | } |
|
|
233 | EV_END_WATCHER (sig, signal) |
|
|
234 | |
|
|
235 | EV_BEGIN_WATCHER (child, child) |
|
|
236 | void set (int pid) |
|
|
237 | { |
|
|
238 | int active = is_active (); |
|
|
239 | if (active) stop (); |
|
|
240 | ev_child_set (static_cast<ev_child *>(this), pid); |
|
|
241 | if (active) start (); |
|
|
242 | } |
|
|
243 | |
|
|
244 | void start (int pid) |
|
|
245 | { |
|
|
246 | set (pid); |
|
|
247 | start (); |
|
|
248 | } |
|
|
249 | EV_END_WATCHER (child, child) |
|
|
250 | |
|
|
251 | #if EV_STAT_ENABLE |
|
|
252 | EV_BEGIN_WATCHER (stat, stat) |
|
|
253 | void set (const char *path, ev_tstamp interval = 0.) |
|
|
254 | { |
|
|
255 | int active = is_active (); |
|
|
256 | if (active) stop (); |
|
|
257 | ev_stat_set (static_cast<ev_stat *>(this), path, interval); |
|
|
258 | if (active) start (); |
|
|
259 | } |
|
|
260 | |
|
|
261 | void start (const char *path, ev_tstamp interval = 0.) |
|
|
262 | { |
|
|
263 | set (path, interval); |
|
|
264 | start (); |
|
|
265 | } |
|
|
266 | |
|
|
267 | void update () |
|
|
268 | { |
|
|
269 | ev_stat_stat (EV_A_ static_cast<ev_stat *>(this)); |
|
|
270 | } |
|
|
271 | EV_END_WATCHER (stat, stat) |
217 | #endif |
272 | #endif |
218 | |
273 | |
219 | EV_BEGIN_WATCHER (idle, idle) |
274 | EV_BEGIN_WATCHER (idle, idle) |
220 | void set () { } |
275 | void set () { } |
221 | EV_END_WATCHER (idle, idle) |
276 | EV_END_WATCHER (idle, idle) |
… | |
… | |
226 | |
281 | |
227 | EV_BEGIN_WATCHER (check, check) |
282 | EV_BEGIN_WATCHER (check, check) |
228 | void set () { } |
283 | void set () { } |
229 | EV_END_WATCHER (check, check) |
284 | EV_END_WATCHER (check, check) |
230 | |
285 | |
231 | EV_BEGIN_WATCHER (sig, signal) |
286 | #if EV_EMBED_ENABLE |
232 | void set (int signum) |
|
|
233 | { |
|
|
234 | int active = is_active (); |
|
|
235 | if (active) stop (); |
|
|
236 | ev_signal_set (static_cast<ev_signal *>(this), signum); |
|
|
237 | if (active) start (); |
|
|
238 | } |
|
|
239 | |
|
|
240 | void start (int signum) |
|
|
241 | { |
|
|
242 | set (signum); |
|
|
243 | start (); |
|
|
244 | } |
|
|
245 | EV_END_WATCHER (sig, signal) |
|
|
246 | |
|
|
247 | EV_BEGIN_WATCHER (child, child) |
|
|
248 | void set (int pid) |
|
|
249 | { |
|
|
250 | int active = is_active (); |
|
|
251 | if (active) stop (); |
|
|
252 | ev_child_set (static_cast<ev_child *>(this), pid); |
|
|
253 | if (active) start (); |
|
|
254 | } |
|
|
255 | |
|
|
256 | void start (int pid) |
|
|
257 | { |
|
|
258 | set (pid); |
|
|
259 | start (); |
|
|
260 | } |
|
|
261 | EV_END_WATCHER (child, child) |
|
|
262 | |
|
|
263 | #if EV_MULTIPLICITY |
|
|
264 | |
|
|
265 | EV_BEGIN_WATCHER (embed, embed) |
287 | EV_BEGIN_WATCHER (embed, embed) |
266 | void set (struct ev_loop *loop) |
288 | void set (struct ev_loop *loop) |
267 | { |
289 | { |
268 | int active = is_active (); |
290 | int active = is_active (); |
269 | if (active) stop (); |
291 | if (active) stop (); |
… | |
… | |
280 | void sweep () |
302 | void sweep () |
281 | { |
303 | { |
282 | ev_embed_sweep (EV_A_ static_cast<ev_embed *>(this)); |
304 | ev_embed_sweep (EV_A_ static_cast<ev_embed *>(this)); |
283 | } |
305 | } |
284 | EV_END_WATCHER (embed, embed) |
306 | EV_END_WATCHER (embed, embed) |
285 | |
|
|
286 | #endif |
307 | #endif |
287 | |
308 | |
288 | #undef EV_CONSTRUCT |
309 | #undef EV_CONSTRUCT |
289 | #undef EV_BEGIN_WATCHER |
310 | #undef EV_BEGIN_WATCHER |
290 | #undef EV_END_WATCHER |
311 | #undef EV_END_WATCHER |