1 | /* |
1 | /* |
2 | * libev simple C++ wrapper classes |
2 | * libev simple C++ wrapper classes |
3 | * |
3 | * |
4 | * Copyright (c) 2007,2008 Marc Alexander Lehmann <libev@schmorp.de> |
4 | * Copyright (c) 2007,2008,2010 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 modifica- |
7 | * Redistribution and use in source and binary forms, with or without modifica- |
8 | * tion, are permitted provided that the following conditions are met: |
8 | * tion, are permitted provided that the following conditions are met: |
9 | * |
9 | * |
… | |
… | |
56 | |
56 | |
57 | namespace ev { |
57 | namespace ev { |
58 | |
58 | |
59 | typedef ev_tstamp tstamp; |
59 | typedef ev_tstamp tstamp; |
60 | |
60 | |
61 | enum { |
61 | enum |
|
|
62 | { |
62 | UNDEF = EV_UNDEF, |
63 | UNDEF = EV_UNDEF, |
63 | NONE = EV_NONE, |
64 | NONE = EV_NONE, |
64 | READ = EV_READ, |
65 | READ = EV_READ, |
65 | WRITE = EV_WRITE, |
66 | WRITE = EV_WRITE, |
|
|
67 | #if EV_COMPAT3 |
66 | TIMEOUT = EV_TIMEOUT, |
68 | TIMEOUT = EV_TIMEOUT, |
|
|
69 | #endif |
|
|
70 | TIMER = EV_TIMER, |
67 | PERIODIC = EV_PERIODIC, |
71 | PERIODIC = EV_PERIODIC, |
68 | SIGNAL = EV_SIGNAL, |
72 | SIGNAL = EV_SIGNAL, |
69 | CHILD = EV_CHILD, |
73 | CHILD = EV_CHILD, |
70 | STAT = EV_STAT, |
74 | STAT = EV_STAT, |
71 | IDLE = EV_IDLE, |
75 | IDLE = EV_IDLE, |
… | |
… | |
73 | PREPARE = EV_PREPARE, |
77 | PREPARE = EV_PREPARE, |
74 | FORK = EV_FORK, |
78 | FORK = EV_FORK, |
75 | ASYNC = EV_ASYNC, |
79 | ASYNC = EV_ASYNC, |
76 | EMBED = EV_EMBED, |
80 | EMBED = EV_EMBED, |
77 | # undef ERROR // some systems stupidly #define ERROR |
81 | # undef ERROR // some systems stupidly #define ERROR |
78 | ERROR = EV_ERROR, |
82 | ERROR = EV_ERROR |
79 | }; |
83 | }; |
80 | |
84 | |
81 | enum |
85 | enum |
82 | { |
86 | { |
83 | AUTO = EVFLAG_AUTO, |
87 | AUTO = EVFLAG_AUTO, |
… | |
… | |
92 | PORT = EVBACKEND_PORT |
96 | PORT = EVBACKEND_PORT |
93 | }; |
97 | }; |
94 | |
98 | |
95 | enum |
99 | enum |
96 | { |
100 | { |
|
|
101 | #if EV_COMPAT3 |
97 | NONBLOCK = EVLOOP_NONBLOCK, |
102 | NONBLOCK = EVLOOP_NONBLOCK, |
98 | ONESHOT = EVLOOP_ONESHOT |
103 | ONESHOT = EVLOOP_ONESHOT, |
|
|
104 | #endif |
|
|
105 | NOWAIT = EVRUN_NOWAIT, |
|
|
106 | ONCE = EVRUN_ONCE |
99 | }; |
107 | }; |
100 | |
108 | |
101 | enum how_t |
109 | enum how_t |
102 | { |
110 | { |
103 | ONE = EVUNLOOP_ONE, |
111 | ONE = EVBREAK_ONE, |
104 | ALL = EVUNLOOP_ALL |
112 | ALL = EVBREAK_ALL |
105 | }; |
113 | }; |
106 | |
114 | |
107 | struct bad_loop |
115 | struct bad_loop |
108 | #if EV_USE_STDEXCEPT |
116 | #if EV_USE_STDEXCEPT |
109 | : std::runtime_error |
117 | : std::runtime_error |
… | |
… | |
159 | return false; |
167 | return false; |
160 | #endif |
168 | #endif |
161 | } |
169 | } |
162 | |
170 | |
163 | #if EV_MULTIPLICITY |
171 | #if EV_MULTIPLICITY |
164 | bool operator == (struct ev_loop *other) const throw () |
172 | bool operator == (const EV_P) const throw () |
165 | { |
173 | { |
166 | return this->EV_AX == other; |
174 | return this->EV_AX == EV_A; |
167 | } |
|
|
168 | |
|
|
169 | bool operator != (struct ev_loop *other) const throw () |
|
|
170 | { |
175 | } |
171 | return ! (*this == other); |
176 | |
|
|
177 | bool operator != (const EV_P) const throw () |
172 | } |
178 | { |
173 | |
|
|
174 | bool operator == (const struct ev_loop *other) const throw () |
|
|
175 | { |
|
|
176 | return this->EV_AX == other; |
|
|
177 | } |
|
|
178 | |
|
|
179 | bool operator != (const struct ev_loop *other) const throw () |
|
|
180 | { |
|
|
181 | return (*this == other); |
179 | return (*this == EV_A); |
182 | } |
180 | } |
183 | |
181 | |
184 | operator struct ev_loop * () const throw () |
182 | operator struct ev_loop * () const throw () |
185 | { |
183 | { |
186 | return EV_AX; |
184 | return EV_AX; |
… | |
… | |
195 | { |
193 | { |
196 | return EV_AX == ev_default_loop (0); |
194 | return EV_AX == ev_default_loop (0); |
197 | } |
195 | } |
198 | #endif |
196 | #endif |
199 | |
197 | |
|
|
198 | #if EV_COMPAT3 |
200 | void loop (int flags = 0) |
199 | void loop (int flags = 0) |
201 | { |
200 | { |
202 | ev_loop (EV_AX_ flags); |
201 | ev_run (EV_AX_ flags); |
203 | } |
202 | } |
204 | |
203 | |
205 | void unloop (how_t how = ONE) throw () |
204 | void unloop (how_t how = ONE) throw () |
206 | { |
205 | { |
207 | ev_unloop (EV_AX_ how); |
206 | ev_break (EV_AX_ how); |
|
|
207 | } |
|
|
208 | #endif |
|
|
209 | |
|
|
210 | void run (int flags = 0) |
|
|
211 | { |
|
|
212 | ev_run (EV_AX_ flags); |
|
|
213 | } |
|
|
214 | |
|
|
215 | void break_loop (how_t how = ONE) throw () |
|
|
216 | { |
|
|
217 | ev_break (EV_AX_ how); |
208 | } |
218 | } |
209 | |
219 | |
210 | void post_fork () throw () |
220 | void post_fork () throw () |
211 | { |
221 | { |
212 | #if EV_MULTIPLICITY |
222 | #if EV_MULTIPLICITY |
… | |
… | |
214 | #else |
224 | #else |
215 | ev_default_fork (); |
225 | ev_default_fork (); |
216 | #endif |
226 | #endif |
217 | } |
227 | } |
218 | |
228 | |
219 | unsigned int count () const throw () |
|
|
220 | { |
|
|
221 | return ev_loop_count (EV_AX); |
|
|
222 | } |
|
|
223 | |
|
|
224 | unsigned int backend () const throw () |
229 | unsigned int backend () const throw () |
225 | { |
230 | { |
226 | return ev_backend (EV_AX); |
231 | return ev_backend (EV_AX); |
227 | } |
232 | } |
228 | |
233 | |
… | |
… | |
239 | void unref () throw () |
244 | void unref () throw () |
240 | { |
245 | { |
241 | ev_unref (EV_AX); |
246 | ev_unref (EV_AX); |
242 | } |
247 | } |
243 | |
248 | |
|
|
249 | #if EV_FEATURE_API |
|
|
250 | unsigned int iteration () const throw () |
|
|
251 | { |
|
|
252 | return ev_iteration (EV_AX); |
|
|
253 | } |
|
|
254 | |
|
|
255 | unsigned int depth () const throw () |
|
|
256 | { |
|
|
257 | return ev_depth (EV_AX); |
|
|
258 | } |
|
|
259 | |
244 | void set_io_collect_interval (tstamp interval) throw () |
260 | void set_io_collect_interval (tstamp interval) throw () |
245 | { |
261 | { |
246 | ev_set_io_collect_interval (EV_AX_ interval); |
262 | ev_set_io_collect_interval (EV_AX_ interval); |
247 | } |
263 | } |
248 | |
264 | |
249 | void set_timeout_collect_interval (tstamp interval) throw () |
265 | void set_timeout_collect_interval (tstamp interval) throw () |
250 | { |
266 | { |
251 | ev_set_timeout_collect_interval (EV_AX_ interval); |
267 | ev_set_timeout_collect_interval (EV_AX_ interval); |
252 | } |
268 | } |
|
|
269 | #endif |
253 | |
270 | |
254 | // function callback |
271 | // function callback |
255 | void once (int fd, int events, tstamp timeout, void (*cb)(int, void *), void* arg = 0) throw () |
272 | void once (int fd, int events, tstamp timeout, void (*cb)(int, void *), void *arg = 0) throw () |
256 | { |
273 | { |
257 | ev_once (EV_AX_ fd, events, timeout, cb, arg); |
274 | ev_once (EV_AX_ fd, events, timeout, cb, arg); |
258 | } |
275 | } |
259 | |
276 | |
260 | // method callback |
277 | // method callback |
… | |
… | |
262 | void once (int fd, int events, tstamp timeout, K *object) throw () |
279 | void once (int fd, int events, tstamp timeout, K *object) throw () |
263 | { |
280 | { |
264 | once (fd, events, timeout, method_thunk<K, method>, object); |
281 | once (fd, events, timeout, method_thunk<K, method>, object); |
265 | } |
282 | } |
266 | |
283 | |
|
|
284 | // default method == operator () |
|
|
285 | template<class K> |
|
|
286 | void once (int fd, int events, tstamp timeout, K *object) throw () |
|
|
287 | { |
|
|
288 | once (fd, events, timeout, method_thunk<K, &K::operator ()>, object); |
|
|
289 | } |
|
|
290 | |
267 | template<class K, void (K::*method)(int)> |
291 | template<class K, void (K::*method)(int)> |
268 | static void method_thunk (int revents, void* arg) |
292 | static void method_thunk (int revents, void *arg) |
269 | { |
|
|
270 | K *obj = static_cast<K *>(arg); |
|
|
271 | (obj->*method) (revents); |
|
|
272 | } |
293 | { |
|
|
294 | static_cast<K *>(arg)->*method |
|
|
295 | (revents); |
|
|
296 | } |
273 | |
297 | |
274 | // const method callback |
298 | // no-argument method callback |
275 | template<class K, void (K::*method)(int) const> |
|
|
276 | void once (int fd, int events, tstamp timeout, const K *object) throw () |
|
|
277 | { |
|
|
278 | once (fd, events, timeout, const_method_thunk<K, method>, object); |
|
|
279 | } |
|
|
280 | |
|
|
281 | template<class K, void (K::*method)(int) const> |
|
|
282 | static void const_method_thunk (int revents, void* arg) |
|
|
283 | { |
|
|
284 | K *obj = static_cast<K *>(arg); |
|
|
285 | (obj->*method) (revents); |
|
|
286 | } |
|
|
287 | |
|
|
288 | // simple method callback |
|
|
289 | template<class K, void (K::*method)()> |
299 | template<class K, void (K::*method)()> |
290 | void once (int fd, int events, tstamp timeout, K *object) throw () |
300 | void once (int fd, int events, tstamp timeout, K *object) throw () |
291 | { |
301 | { |
292 | once (fd, events, timeout, method_noargs_thunk<K, method>, object); |
302 | once (fd, events, timeout, method_noargs_thunk<K, method>, object); |
293 | } |
303 | } |
294 | |
304 | |
295 | template<class K, void (K::*method)()> |
305 | template<class K, void (K::*method)()> |
296 | static void method_noargs_thunk (int revents, void* arg) |
306 | static void method_noargs_thunk (int revents, void *arg) |
297 | { |
307 | { |
298 | K *obj = static_cast<K *>(arg); |
308 | static_cast<K *>(arg)->*method |
299 | (obj->*method) (); |
309 | (); |
300 | } |
310 | } |
301 | |
311 | |
302 | // simpler function callback |
312 | // simpler function callback |
303 | template<void (*cb)(int)> |
313 | template<void (*cb)(int)> |
304 | void once (int fd, int events, tstamp timeout) throw () |
314 | void once (int fd, int events, tstamp timeout) throw () |
305 | { |
315 | { |
306 | once (fd, events, timeout, simpler_func_thunk<cb>); |
316 | once (fd, events, timeout, simpler_func_thunk<cb>); |
307 | } |
317 | } |
308 | |
318 | |
309 | template<void (*cb)(int)> |
319 | template<void (*cb)(int)> |
310 | static void simpler_func_thunk (int revents, void* arg) |
320 | static void simpler_func_thunk (int revents, void *arg) |
311 | { |
321 | { |
|
|
322 | (*cb) |
312 | (*cb) (revents); |
323 | (revents); |
313 | } |
324 | } |
314 | |
325 | |
315 | // simplest function callback |
326 | // simplest function callback |
316 | template<void (*cb)()> |
327 | template<void (*cb)()> |
317 | void once (int fd, int events, tstamp timeout) throw () |
328 | void once (int fd, int events, tstamp timeout) throw () |
318 | { |
329 | { |
319 | once (fd, events, timeout, simplest_func_thunk<cb>); |
330 | once (fd, events, timeout, simplest_func_thunk<cb>); |
320 | } |
331 | } |
321 | |
332 | |
322 | template<void (*cb)()> |
333 | template<void (*cb)()> |
323 | static void simplest_func_thunk (int revents, void* arg) |
334 | static void simplest_func_thunk (int revents, void *arg) |
324 | { |
335 | { |
325 | (*cb) (); |
336 | (*cb) |
|
|
337 | (); |
326 | } |
338 | } |
327 | |
339 | |
328 | void feed_fd_event (int fd, int revents) throw () |
340 | void feed_fd_event (int fd, int revents) throw () |
329 | { |
341 | { |
330 | ev_feed_fd_event (EV_AX_ fd, revents); |
342 | ev_feed_fd_event (EV_AX_ fd, revents); |
… | |
… | |
420 | struct base : ev_watcher |
432 | struct base : ev_watcher |
421 | { |
433 | { |
422 | #if EV_MULTIPLICITY |
434 | #if EV_MULTIPLICITY |
423 | EV_PX; |
435 | EV_PX; |
424 | |
436 | |
|
|
437 | // loop set |
425 | void set (EV_PX) throw () |
438 | void set (EV_P) throw () |
426 | { |
439 | { |
427 | this->EV_A = EV_A; |
440 | this->EV_A = EV_A; |
428 | } |
441 | } |
429 | #endif |
442 | #endif |
430 | |
443 | |
… | |
… | |
434 | #endif |
447 | #endif |
435 | { |
448 | { |
436 | ev_init (this, 0); |
449 | ev_init (this, 0); |
437 | } |
450 | } |
438 | |
451 | |
439 | void set_ (void *data, void (*cb)(EV_P_ ev_watcher *w, int revents)) throw () |
452 | void set_ (const void *data, void (*cb)(EV_P_ ev_watcher *w, int revents)) throw () |
440 | { |
453 | { |
441 | this->data = data; |
454 | this->data = (void *)data; |
442 | ev_set_cb (static_cast<ev_watcher *>(this), cb); |
455 | ev_set_cb (static_cast<ev_watcher *>(this), cb); |
|
|
456 | } |
|
|
457 | |
|
|
458 | // function callback |
|
|
459 | template<void (*function)(watcher &w, int)> |
|
|
460 | void set (void *data = 0) throw () |
|
|
461 | { |
|
|
462 | set_ (data, function_thunk<function>); |
|
|
463 | } |
|
|
464 | |
|
|
465 | template<void (*function)(watcher &w, int)> |
|
|
466 | static void function_thunk (EV_P_ ev_watcher *w, int revents) |
|
|
467 | { |
|
|
468 | function |
|
|
469 | (*static_cast<watcher *>(w), revents); |
443 | } |
470 | } |
444 | |
471 | |
445 | // method callback |
472 | // method callback |
446 | template<class K, void (K::*method)(watcher &w, int)> |
473 | template<class K, void (K::*method)(watcher &w, int)> |
447 | void set (K *object) throw () |
474 | void set (K *object) throw () |
448 | { |
475 | { |
449 | set_ (object, method_thunk<K, method>); |
476 | set_ (object, method_thunk<K, method>); |
450 | } |
477 | } |
451 | |
478 | |
|
|
479 | // default method == operator () |
|
|
480 | template<class K> |
|
|
481 | void set (K *object) throw () |
|
|
482 | { |
|
|
483 | set_ (object, method_thunk<K, &K::operator ()>); |
|
|
484 | } |
|
|
485 | |
452 | template<class K, void (K::*method)(watcher &w, int)> |
486 | template<class K, void (K::*method)(watcher &w, int)> |
453 | static void method_thunk (EV_P_ ev_watcher *w, int revents) |
487 | static void method_thunk (EV_P_ ev_watcher *w, int revents) |
454 | { |
488 | { |
455 | K *obj = static_cast<K *>(w->data); |
489 | (static_cast<K *>(w->data)->*method) |
456 | (obj->*method) (*static_cast<watcher *>(w), revents); |
|
|
457 | } |
|
|
458 | |
|
|
459 | // const method callback |
|
|
460 | template<class K, void (K::*method)(watcher &w, int) const> |
|
|
461 | void set (const K *object) throw () |
|
|
462 | { |
|
|
463 | set_ (object, const_method_thunk<K, method>); |
|
|
464 | } |
|
|
465 | |
|
|
466 | template<class K, void (K::*method)(watcher &w, int) const> |
|
|
467 | static void const_method_thunk (EV_P_ ev_watcher *w, int revents) |
|
|
468 | { |
|
|
469 | K *obj = static_cast<K *>(w->data); |
|
|
470 | (static_cast<K *>(w->data)->*method) (*static_cast<watcher *>(w), revents); |
|
|
471 | } |
|
|
472 | |
|
|
473 | // function callback |
|
|
474 | template<void (*function)(watcher &w, int)> |
|
|
475 | void set (void *data = 0) throw () |
|
|
476 | { |
|
|
477 | set_ (data, function_thunk<function>); |
|
|
478 | } |
|
|
479 | |
|
|
480 | template<void (*function)(watcher &w, int)> |
|
|
481 | static void function_thunk (EV_P_ ev_watcher *w, int revents) |
|
|
482 | { |
|
|
483 | function (*static_cast<watcher *>(w), revents); |
490 | (*static_cast<watcher *>(w), revents); |
484 | } |
491 | } |
485 | |
492 | |
486 | // simple callback |
493 | // no-argument callback |
487 | template<class K, void (K::*method)()> |
494 | template<class K, void (K::*method)()> |
488 | void set (K *object) throw () |
495 | void set (K *object) throw () |
489 | { |
496 | { |
490 | set_ (object, method_noargs_thunk<K, method>); |
497 | set_ (object, method_noargs_thunk<K, method>); |
491 | } |
498 | } |
492 | |
499 | |
493 | template<class K, void (K::*method)()> |
500 | template<class K, void (K::*method)()> |
494 | static void method_noargs_thunk (EV_P_ ev_watcher *w, int revents) |
501 | static void method_noargs_thunk (EV_P_ ev_watcher *w, int revents) |
495 | { |
502 | { |
496 | K *obj = static_cast<K *>(w->data); |
503 | (static_cast<K *>(w->data)->*method) |
497 | (obj->*method) (); |
504 | (); |
498 | } |
505 | } |
499 | |
506 | |
500 | void operator ()(int events = EV_UNDEF) |
507 | void operator ()(int events = EV_UNDEF) |
501 | { |
508 | { |
|
|
509 | return |
502 | return ev_cb (static_cast<ev_watcher *>(this)) |
510 | ev_cb (static_cast<ev_watcher *>(this)) |
503 | (static_cast<ev_watcher *>(this), events); |
511 | (static_cast<ev_watcher *>(this), events); |
504 | } |
512 | } |
505 | |
513 | |
506 | bool is_active () const throw () |
514 | bool is_active () const throw () |
507 | { |
515 | { |
508 | return ev_is_active (static_cast<const ev_watcher *>(this)); |
516 | return ev_is_active (static_cast<const ev_watcher *>(this)); |
… | |
… | |
654 | |
662 | |
655 | void again () throw () |
663 | void again () throw () |
656 | { |
664 | { |
657 | ev_timer_again (EV_A_ static_cast<ev_timer *>(this)); |
665 | ev_timer_again (EV_A_ static_cast<ev_timer *>(this)); |
658 | } |
666 | } |
|
|
667 | |
|
|
668 | ev_tstamp remaining () |
|
|
669 | { |
|
|
670 | return ev_timer_remaining (EV_A_ static_cast<ev_timer *>(this)); |
|
|
671 | } |
659 | EV_END_WATCHER (timer, timer) |
672 | EV_END_WATCHER (timer, timer) |
660 | |
673 | |
661 | #if EV_PERIODIC_ENABLE |
674 | #if EV_PERIODIC_ENABLE |
662 | EV_BEGIN_WATCHER (periodic, periodic) |
675 | EV_BEGIN_WATCHER (periodic, periodic) |
663 | void set (ev_tstamp at, ev_tstamp interval = 0.) throw () |
676 | void set (ev_tstamp at, ev_tstamp interval = 0.) throw () |
… | |
… | |
679 | ev_periodic_again (EV_A_ static_cast<ev_periodic *>(this)); |
692 | ev_periodic_again (EV_A_ static_cast<ev_periodic *>(this)); |
680 | } |
693 | } |
681 | EV_END_WATCHER (periodic, periodic) |
694 | EV_END_WATCHER (periodic, periodic) |
682 | #endif |
695 | #endif |
683 | |
696 | |
|
|
697 | #if EV_SIGNAL_ENABLE |
684 | EV_BEGIN_WATCHER (sig, signal) |
698 | EV_BEGIN_WATCHER (sig, signal) |
685 | void set (int signum) throw () |
699 | void set (int signum) throw () |
686 | { |
700 | { |
687 | int active = is_active (); |
701 | int active = is_active (); |
688 | if (active) stop (); |
702 | if (active) stop (); |
… | |
… | |
694 | { |
708 | { |
695 | set (signum); |
709 | set (signum); |
696 | start (); |
710 | start (); |
697 | } |
711 | } |
698 | EV_END_WATCHER (sig, signal) |
712 | EV_END_WATCHER (sig, signal) |
|
|
713 | #endif |
699 | |
714 | |
|
|
715 | #if EV_CHILD_ENABLE |
700 | EV_BEGIN_WATCHER (child, child) |
716 | EV_BEGIN_WATCHER (child, child) |
701 | void set (int pid, int trace = 0) throw () |
717 | void set (int pid, int trace = 0) throw () |
702 | { |
718 | { |
703 | int active = is_active (); |
719 | int active = is_active (); |
704 | if (active) stop (); |
720 | if (active) stop (); |
… | |
… | |
710 | { |
726 | { |
711 | set (pid, trace); |
727 | set (pid, trace); |
712 | start (); |
728 | start (); |
713 | } |
729 | } |
714 | EV_END_WATCHER (child, child) |
730 | EV_END_WATCHER (child, child) |
|
|
731 | #endif |
715 | |
732 | |
716 | #if EV_STAT_ENABLE |
733 | #if EV_STAT_ENABLE |
717 | EV_BEGIN_WATCHER (stat, stat) |
734 | EV_BEGIN_WATCHER (stat, stat) |
718 | void set (const char *path, ev_tstamp interval = 0.) throw () |
735 | void set (const char *path, ev_tstamp interval = 0.) throw () |
719 | { |
736 | { |
… | |
… | |
735 | ev_stat_stat (EV_A_ static_cast<ev_stat *>(this)); |
752 | ev_stat_stat (EV_A_ static_cast<ev_stat *>(this)); |
736 | } |
753 | } |
737 | EV_END_WATCHER (stat, stat) |
754 | EV_END_WATCHER (stat, stat) |
738 | #endif |
755 | #endif |
739 | |
756 | |
|
|
757 | #if EV_IDLE_ENABLE |
740 | EV_BEGIN_WATCHER (idle, idle) |
758 | EV_BEGIN_WATCHER (idle, idle) |
741 | void set () throw () { } |
759 | void set () throw () { } |
742 | EV_END_WATCHER (idle, idle) |
760 | EV_END_WATCHER (idle, idle) |
|
|
761 | #endif |
743 | |
762 | |
|
|
763 | #if EV_PREPARE_ENABLE |
744 | EV_BEGIN_WATCHER (prepare, prepare) |
764 | EV_BEGIN_WATCHER (prepare, prepare) |
745 | void set () throw () { } |
765 | void set () throw () { } |
746 | EV_END_WATCHER (prepare, prepare) |
766 | EV_END_WATCHER (prepare, prepare) |
|
|
767 | #endif |
747 | |
768 | |
|
|
769 | #if EV_CHECK_ENABLE |
748 | EV_BEGIN_WATCHER (check, check) |
770 | EV_BEGIN_WATCHER (check, check) |
749 | void set () throw () { } |
771 | void set () throw () { } |
750 | EV_END_WATCHER (check, check) |
772 | EV_END_WATCHER (check, check) |
|
|
773 | #endif |
751 | |
774 | |
752 | #if EV_EMBED_ENABLE |
775 | #if EV_EMBED_ENABLE |
753 | EV_BEGIN_WATCHER (embed, embed) |
776 | EV_BEGIN_WATCHER (embed, embed) |
754 | void set (struct ev_loop *embedded_loop) throw () |
777 | void set (struct ev_loop *embedded_loop) throw () |
755 | { |
778 | { |
… | |
… | |
778 | EV_END_WATCHER (fork, fork) |
801 | EV_END_WATCHER (fork, fork) |
779 | #endif |
802 | #endif |
780 | |
803 | |
781 | #if EV_ASYNC_ENABLE |
804 | #if EV_ASYNC_ENABLE |
782 | EV_BEGIN_WATCHER (async, async) |
805 | EV_BEGIN_WATCHER (async, async) |
783 | void set () throw () { } |
|
|
784 | |
|
|
785 | void send () throw () |
806 | void send () throw () |
786 | { |
807 | { |
787 | ev_async_send (EV_A_ static_cast<ev_async *>(this)); |
808 | ev_async_send (EV_A_ static_cast<ev_async *>(this)); |
788 | } |
809 | } |
789 | |
810 | |