ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev++.h
(Generate patch)

Comparing libev/ev++.h (file contents):
Revision 1.30 by llucax, Fri Jan 18 18:15:35 2008 UTC vs.
Revision 1.32 by root, Sat Jan 19 00:49:06 2008 UTC

44# include EV_H 44# include EV_H
45#else 45#else
46# include "ev.h" 46# include "ev.h"
47#endif 47#endif
48 48
49#ifndef EV_CXX_EXCEPTIONS 49#ifndef EV_USE_STDEXCEPT
50#define EV_CXX_EXCEPTIONS 1 50# define EV_USE_STDEXCEPT 1
51#endif 51#endif
52 52
53#undef EV_THROW 53#if EV_USE_STDEXCEPT
54#if EV_CXX_EXCEPTIONS
55# include <stdexcept> 54# include <stdexcept>
56# define EV_THROW(exception) throw (exception)
57#else
58# define EV_THROW(exception)
59#endif 55#endif
60 56
61namespace ev { 57namespace ev {
62 58
63 typedef ev_tstamp tstamp; 59 typedef ev_tstamp tstamp;
103 { 99 {
104 ONE = EVUNLOOP_ONE, 100 ONE = EVUNLOOP_ONE,
105 ALL = EVUNLOOP_ALL 101 ALL = EVUNLOOP_ALL
106 }; 102 };
107 103
108#if EV_CXX_EXCEPTIONS 104 struct bad_loop
109 struct bad_loop: std::runtime_error 105#if EV_USE_STDEXCEPT
106 : std::runtime_error
107#endif
110 { 108 {
109#if EV_USE_STDEXCEPT
111 bad_loop() 110 bad_loop ()
112 : std::runtime_error("loop can't be initialized") {} 111 : std::runtime_error ("libev event loop cannot be initialized, bad value of LIBEV_FLAGS?")
113 }; 112 {
113 }
114#endif 114#endif
115 };
115 116
116#ifdef EV_AX 117#ifdef EV_AX
117# undef EV_AX 118# undef EV_AX
118#endif 119#endif
119 120
130#endif 131#endif
131 132
132 struct loop_ref 133 struct loop_ref
133 { 134 {
134 135
135 loop_ref (EV_P) 136 loop_ref (EV_P) throw (bad_loop)
136#if EV_MULTIPLICITY 137#if EV_MULTIPLICITY
137 EV_THROW (bad_loop) : EV_AX (EV_A) 138 : EV_AX (EV_A)
138#endif 139#endif
139 { 140 {
140#if EV_MULTIPLICIY && EV_CXX_EXCEPTIONS 141#if EV_MULTIPLICITY
141 if (!EV_A) 142 if (!EV_AX)
142 throw bad_loop (); 143 throw bad_loop ();
143#endif 144#endif
144 } 145 }
145 146
146 bool operator== (const loop_ref &other) const EV_THROW () 147 bool operator == (const loop_ref &other) const throw ()
147 { 148 {
148#if EV_MULTIPLICITY 149#if EV_MULTIPLICITY
149 return this->EV_AX == other.EV_AX; 150 return EV_AX == other.EV_AX;
150#else 151#else
151 return true; 152 return true;
152#endif 153#endif
153 } 154 }
154 155
155 bool operator!= (const loop_ref &other) const EV_THROW () 156 bool operator != (const loop_ref &other) const throw ()
156 { 157 {
157#if EV_MULTIPLICITY 158#if EV_MULTIPLICITY
158 return ! (*this == other); 159 return ! (*this == other);
159#else 160#else
160 return false; 161 return false;
161#endif 162#endif
162 } 163 }
163 164
164#if EV_MULTIPLICITY 165#if EV_MULTIPLICITY
165 bool operator== (struct ev_loop *other) const EV_THROW () 166 bool operator== (struct ev_loop *other) const throw ()
166 { 167 {
167 return this->EV_AX == other; 168 return this->EV_AX == other;
168 } 169 }
169 170
170 bool operator!= (struct ev_loop *other) const EV_THROW () 171 bool operator!= (struct ev_loop *other) const throw ()
171 { 172 {
172 return ! (*this == other); 173 return ! (*this == other);
173 } 174 }
174 175
175 bool operator== (const struct ev_loop *other) const EV_THROW () 176 bool operator== (const struct ev_loop *other) const throw ()
176 { 177 {
177 return this->EV_AX == other; 178 return this->EV_AX == other;
178 } 179 }
179 180
180 bool operator!= (const struct ev_loop *other) const EV_THROW () 181 bool operator!= (const struct ev_loop *other) const throw ()
181 { 182 {
182 return (*this == other); 183 return (*this == other);
183 } 184 }
184 185
185 operator struct ev_loop * () const EV_THROW () 186 operator struct ev_loop * () const throw ()
186 { 187 {
187 return EV_AX; 188 return EV_AX;
188 } 189 }
189 190
190 operator const struct ev_loop * () const EV_THROW () 191 operator const struct ev_loop * () const throw ()
191 { 192 {
192 return EV_AX; 193 return EV_AX;
193 } 194 }
194 195
195 bool is_default () const EV_THROW () 196 bool is_default () const throw ()
196 { 197 {
197 return EV_AX == ev_default_loop (0); 198 return EV_AX == ev_default_loop (0);
198 } 199 }
199#endif 200#endif
200 201
201 void loop (int flags = 0) 202 void loop (int flags = 0)
202 { 203 {
203 ev_loop (EV_AX_ flags); 204 ev_loop (EV_AX_ flags);
204 } 205 }
205 206
206 void unloop (how_t how = ONE) EV_THROW () 207 void unloop (how_t how = ONE) throw ()
207 { 208 {
208 ev_unloop (EV_AX_ how); 209 ev_unloop (EV_AX_ how);
209 } 210 }
210 211
211 void post_fork () EV_THROW () 212 void post_fork () throw ()
212 { 213 {
213#if EV_MULTIPLICITY 214#if EV_MULTIPLICITY
214 ev_loop_fork (EV_AX); 215 ev_loop_fork (EV_AX);
215#else 216#else
216 ev_default_fork (); 217 ev_default_fork ();
217#endif 218#endif
218 } 219 }
219 220
220 unsigned int count () const EV_THROW () 221 unsigned int count () const throw ()
221 { 222 {
222 return ev_loop_count (EV_AX); 223 return ev_loop_count (EV_AX);
223 } 224 }
224 225
225 unsigned int backend () const EV_THROW () 226 unsigned int backend () const throw ()
226 { 227 {
227 return ev_backend (EV_AX); 228 return ev_backend (EV_AX);
228 } 229 }
229 230
230 tstamp now () const EV_THROW () 231 tstamp now () const throw ()
231 { 232 {
232 return ev_now (EV_AX); 233 return ev_now (EV_AX);
233 } 234 }
234 235
235 void ref () EV_THROW () 236 void ref () throw ()
236 { 237 {
237 ev_ref (EV_AX); 238 ev_ref (EV_AX);
238 } 239 }
239 240
240 void unref () EV_THROW () 241 void unref () throw ()
241 { 242 {
242 ev_unref (EV_AX); 243 ev_unref (EV_AX);
243 } 244 }
244 245
245 void set_io_collect_interval (tstamp interval) EV_THROW () 246 void set_io_collect_interval (tstamp interval) throw ()
246 { 247 {
247 ev_set_io_collect_interval (EV_AX_ interval); 248 ev_set_io_collect_interval (EV_AX_ interval);
248 } 249 }
249 250
250 void set_timeout_collect_interval (tstamp interval) EV_THROW () 251 void set_timeout_collect_interval (tstamp interval) throw ()
251 { 252 {
252 ev_set_timeout_collect_interval (EV_AX_ interval); 253 ev_set_timeout_collect_interval (EV_AX_ interval);
253 } 254 }
254 255
255 // function callback 256 // function callback
256 void once (int fd, int events, tstamp timeout, void (*cb)(int, void *), void* arg = 0) EV_THROW () 257 void once (int fd, int events, tstamp timeout, void (*cb)(int, void *), void* arg = 0) throw ()
257 { 258 {
258 ev_once (EV_AX_ fd, events, timeout, cb, arg); 259 ev_once (EV_AX_ fd, events, timeout, cb, arg);
259 } 260 }
260 261
261 // method callback 262 // method callback
262 template<class K, void (K::*method)(int)> 263 template<class K, void (K::*method)(int)>
263 void once (int fd, int events, tstamp timeout, K *object) EV_THROW () 264 void once (int fd, int events, tstamp timeout, K *object) throw ()
264 { 265 {
265 once (fd, events, timeout, method_thunk<K, method>, object); 266 once (fd, events, timeout, method_thunk<K, method>, object);
266 } 267 }
267 268
268 template<class K, void (K::*method)(int)> 269 template<class K, void (K::*method)(int)>
272 (obj->*method) (revents); 273 (obj->*method) (revents);
273 } 274 }
274 275
275 // const method callback 276 // const method callback
276 template<class K, void (K::*method)(int) const> 277 template<class K, void (K::*method)(int) const>
277 void once (int fd, int events, tstamp timeout, const K *object) EV_THROW () 278 void once (int fd, int events, tstamp timeout, const K *object) throw ()
278 { 279 {
279 once (fd, events, timeout, const_method_thunk<K, method>, object); 280 once (fd, events, timeout, const_method_thunk<K, method>, object);
280 } 281 }
281 282
282 template<class K, void (K::*method)(int) const> 283 template<class K, void (K::*method)(int) const>
286 (obj->*method) (revents); 287 (obj->*method) (revents);
287 } 288 }
288 289
289 // simple method callback 290 // simple method callback
290 template<class K, void (K::*method)()> 291 template<class K, void (K::*method)()>
291 void once (int fd, int events, tstamp timeout, K *object) EV_THROW () 292 void once (int fd, int events, tstamp timeout, K *object) throw ()
292 { 293 {
293 once (fd, events, timeout, method_noargs_thunk<K, method>, object); 294 once (fd, events, timeout, method_noargs_thunk<K, method>, object);
294 } 295 }
295 296
296 template<class K, void (K::*method)()> 297 template<class K, void (K::*method)()>
300 (obj->*method) (); 301 (obj->*method) ();
301 } 302 }
302 303
303 // simpler function callback 304 // simpler function callback
304 template<void (*cb)(int)> 305 template<void (*cb)(int)>
305 void once (int fd, int events, tstamp timeout) EV_THROW () 306 void once (int fd, int events, tstamp timeout) throw ()
306 { 307 {
307 once (fd, events, timeout, simpler_func_thunk<cb>); 308 once (fd, events, timeout, simpler_func_thunk<cb>);
308 } 309 }
309 310
310 template<void (*cb)(int)> 311 template<void (*cb)(int)>
313 (*cb) (revents); 314 (*cb) (revents);
314 } 315 }
315 316
316 // simplest function callback 317 // simplest function callback
317 template<void (*cb)()> 318 template<void (*cb)()>
318 void once (int fd, int events, tstamp timeout) EV_THROW () 319 void once (int fd, int events, tstamp timeout) throw ()
319 { 320 {
320 once (fd, events, timeout, simplest_func_thunk<cb>); 321 once (fd, events, timeout, simplest_func_thunk<cb>);
321 } 322 }
322 323
323 template<void (*cb)()> 324 template<void (*cb)()>
324 static void simplest_func_thunk (int revents, void* arg) 325 static void simplest_func_thunk (int revents, void* arg)
325 { 326 {
326 (*cb) (); 327 (*cb) ();
327 } 328 }
328 329
329 void feed_fd_event (int fd, int revents) EV_THROW () 330 void feed_fd_event (int fd, int revents) throw ()
330 { 331 {
331 ev_feed_fd_event (EV_AX_ fd, revents); 332 ev_feed_fd_event (EV_AX_ fd, revents);
332 } 333 }
333 334
334 void feed_signal_event (int signum) EV_THROW () 335 void feed_signal_event (int signum) throw ()
335 { 336 {
336 ev_feed_signal_event (EV_AX_ signum); 337 ev_feed_signal_event (EV_AX_ signum);
337 } 338 }
338 339
339#if EV_MULTIPLICITY 340#if EV_MULTIPLICITY
349 dynamic_loop (unsigned int flags = AUTO) EV_THROW (bad_loop) 350 dynamic_loop (unsigned int flags = AUTO) EV_THROW (bad_loop)
350 : loop_ref (ev_loop_new (flags)) 351 : loop_ref (ev_loop_new (flags))
351 { 352 {
352 } 353 }
353 354
354 ~dynamic_loop () EV_THROW () 355 ~dynamic_loop () throw ()
355 { 356 {
356 ev_loop_destroy (EV_AX); 357 ev_loop_destroy (EV_AX);
357 EV_AX = 0; 358 EV_AX = 0;
358 } 359 }
359 360
367#endif 368#endif
368 369
369 struct default_loop: loop_ref 370 struct default_loop: loop_ref
370 { 371 {
371 372
372 default_loop (unsigned int flags = AUTO) EV_THROW (bad_loop) 373 default_loop (unsigned int flags = AUTO) throw (bad_loop)
373#if EV_MULTIPLICITY 374#if EV_MULTIPLICITY
374 : loop_ref (ev_default_loop (flags)) 375 : loop_ref (ev_default_loop (flags))
375 { 376#endif
376 } 377 {
377#else 378#ifndef EV_MULTIPLICITY
378 {
379 #if EV_CXX_EXCEPTIONS
380 int r =
381 #endif
382 ev_default_loop (flags); 379 if (!ev_default_loop (flags))
383 #if EV_CXX_EXCEPTIONS
384 if (!r)
385 throw bad_loop (); 380 throw bad_loop ();
386 #endif 381#endif
387 } 382 }
388#endif
389 383
390 ~default_loop () EV_THROW () 384 ~default_loop () throw ()
391 { 385 {
392 ev_default_destroy (); 386 ev_default_destroy ();
393#if EV_MULTIPLICITY
394 EV_AX = 0;
395#endif
396 } 387 }
397 388
398 private: 389 private:
399
400 default_loop (const default_loop &); 390 default_loop (const default_loop &);
401
402 default_loop & operator= (const default_loop &); 391 default_loop &operator = (const default_loop &);
403
404 }; 392 };
405 393
406 inline loop_ref get_default_loop () EV_THROW () 394 inline loop_ref get_default_loop () throw ()
407 { 395 {
408#if EV_MULTIPLICITY 396#if EV_MULTIPLICITY
409 return ev_default_loop (0); 397 return ev_default_loop (0);
410#else 398#else
411 return loop_ref (); 399 return loop_ref ();
429 struct base : ev_watcher 417 struct base : ev_watcher
430 { 418 {
431 #if EV_MULTIPLICITY 419 #if EV_MULTIPLICITY
432 EV_PX; 420 EV_PX;
433 421
434 void set (EV_PX) EV_THROW () 422 void set (EV_PX) throw ()
435 { 423 {
436 this->EV_A = EV_A; 424 this->EV_A = EV_A;
437 } 425 }
438 #endif 426 #endif
439 427
440 base (EV_PX) EV_THROW () 428 base (EV_PX) throw ()
441 #if EV_MULTIPLICITY 429 #if EV_MULTIPLICITY
442 : EV_A (EV_A) 430 : EV_A (EV_A)
443 #endif 431 #endif
444 { 432 {
445 ev_init (this, 0); 433 ev_init (this, 0);
446 } 434 }
447 435
448 void set_ (void *data, void (*cb)(EV_P_ ev_watcher *w, int revents)) EV_THROW () 436 void set_ (void *data, void (*cb)(EV_P_ ev_watcher *w, int revents)) throw ()
449 { 437 {
450 this->data = data; 438 this->data = data;
451 ev_set_cb (static_cast<ev_watcher *>(this), cb); 439 ev_set_cb (static_cast<ev_watcher *>(this), cb);
452 } 440 }
453 441
454 // method callback 442 // method callback
455 template<class K, void (K::*method)(watcher &w, int)> 443 template<class K, void (K::*method)(watcher &w, int)>
456 void set (K *object) EV_THROW () 444 void set (K *object) throw ()
457 { 445 {
458 set_ (object, method_thunk<K, method>); 446 set_ (object, method_thunk<K, method>);
459 } 447 }
460 448
461 template<class K, void (K::*method)(watcher &w, int)> 449 template<class K, void (K::*method)(watcher &w, int)>
465 (obj->*method) (*static_cast<watcher *>(w), revents); 453 (obj->*method) (*static_cast<watcher *>(w), revents);
466 } 454 }
467 455
468 // const method callback 456 // const method callback
469 template<class K, void (K::*method)(watcher &w, int) const> 457 template<class K, void (K::*method)(watcher &w, int) const>
470 void set (const K *object) EV_THROW () 458 void set (const K *object) throw ()
471 { 459 {
472 set_ (object, const_method_thunk<K, method>); 460 set_ (object, const_method_thunk<K, method>);
473 } 461 }
474 462
475 template<class K, void (K::*method)(watcher &w, int) const> 463 template<class K, void (K::*method)(watcher &w, int) const>
479 (static_cast<K *>(w->data)->*method) (*static_cast<watcher *>(w), revents); 467 (static_cast<K *>(w->data)->*method) (*static_cast<watcher *>(w), revents);
480 } 468 }
481 469
482 // function callback 470 // function callback
483 template<void (*function)(watcher &w, int)> 471 template<void (*function)(watcher &w, int)>
484 void set (void *data = 0) EV_THROW () 472 void set (void *data = 0) throw ()
485 { 473 {
486 set_ (data, function_thunk<function>); 474 set_ (data, function_thunk<function>);
487 } 475 }
488 476
489 template<void (*function)(watcher &w, int)> 477 template<void (*function)(watcher &w, int)>
492 function (*static_cast<watcher *>(w), revents); 480 function (*static_cast<watcher *>(w), revents);
493 } 481 }
494 482
495 // simple callback 483 // simple callback
496 template<class K, void (K::*method)()> 484 template<class K, void (K::*method)()>
497 void set (K *object) EV_THROW () 485 void set (K *object) throw ()
498 { 486 {
499 set_ (object, method_noargs_thunk<K, method>); 487 set_ (object, method_noargs_thunk<K, method>);
500 } 488 }
501 489
502 template<class K, void (K::*method)()> 490 template<class K, void (K::*method)()>
510 { 498 {
511 return ev_cb (static_cast<ev_watcher *>(this)) 499 return ev_cb (static_cast<ev_watcher *>(this))
512 (static_cast<ev_watcher *>(this), events); 500 (static_cast<ev_watcher *>(this), events);
513 } 501 }
514 502
515 bool is_active () const EV_THROW () 503 bool is_active () const throw ()
516 { 504 {
517 return ev_is_active (static_cast<const ev_watcher *>(this)); 505 return ev_is_active (static_cast<const ev_watcher *>(this));
518 } 506 }
519 507
520 bool is_pending () const EV_THROW () 508 bool is_pending () const throw ()
521 { 509 {
522 return ev_is_pending (static_cast<const ev_watcher *>(this)); 510 return ev_is_pending (static_cast<const ev_watcher *>(this));
523 } 511 }
524 512
525 void feed_event (int revents) EV_THROW () 513 void feed_event (int revents) throw ()
526 { 514 {
527 ev_feed_event (EV_A_ static_cast<const ev_watcher *>(this), revents); 515 ev_feed_event (EV_A_ static_cast<const ev_watcher *>(this), revents);
528 } 516 }
529 }; 517 };
530 518
531 inline tstamp now () EV_THROW () 519 inline tstamp now () throw ()
532 { 520 {
533 return ev_time (); 521 return ev_time ();
534 } 522 }
535 523
536 inline void delay (tstamp interval) EV_THROW () 524 inline void delay (tstamp interval) throw ()
537 { 525 {
538 ev_sleep (interval); 526 ev_sleep (interval);
539 } 527 }
540 528
541 inline int version_major () EV_THROW () 529 inline int version_major () throw ()
542 { 530 {
543 return ev_version_major (); 531 return ev_version_major ();
544 } 532 }
545 533
546 inline int version_minor () EV_THROW () 534 inline int version_minor () throw ()
547 { 535 {
548 return ev_version_minor (); 536 return ev_version_minor ();
549 } 537 }
550 538
551 inline unsigned int supported_backends () EV_THROW () 539 inline unsigned int supported_backends () throw ()
552 { 540 {
553 return ev_supported_backends (); 541 return ev_supported_backends ();
554 } 542 }
555 543
556 inline unsigned int recommended_backends () EV_THROW () 544 inline unsigned int recommended_backends () throw ()
557 { 545 {
558 return ev_recommended_backends (); 546 return ev_recommended_backends ();
559 } 547 }
560 548
561 inline unsigned int embeddable_backends () EV_THROW () 549 inline unsigned int embeddable_backends () throw ()
562 { 550 {
563 return ev_embeddable_backends (); 551 return ev_embeddable_backends ();
564 } 552 }
565 553
566 inline void set_allocator (void *(*cb)(void *ptr, long size)) EV_THROW () 554 inline void set_allocator (void *(*cb)(void *ptr, long size)) throw ()
567 { 555 {
568 ev_set_allocator (cb); 556 ev_set_allocator (cb);
569 } 557 }
570 558
571 inline void set_syserr_cb (void (*cb)(const char *msg)) EV_THROW () 559 inline void set_syserr_cb (void (*cb)(const char *msg)) throw ()
572 { 560 {
573 ev_set_syserr_cb (cb); 561 ev_set_syserr_cb (cb);
574 } 562 }
575 563
576 #if EV_MULTIPLICITY 564 #if EV_MULTIPLICITY
577 #define EV_CONSTRUCT(cppstem,cstem) \ 565 #define EV_CONSTRUCT(cppstem,cstem) \
578 (EV_PX = get_default_loop ()) EV_THROW () \ 566 (EV_PX = get_default_loop ()) throw () \
579 : base<ev_ ## cstem, cppstem> (EV_A) \ 567 : base<ev_ ## cstem, cppstem> (EV_A) \
580 { \ 568 { \
581 } 569 }
582 #else 570 #else
583 #define EV_CONSTRUCT(cppstem,cstem) \ 571 #define EV_CONSTRUCT(cppstem,cstem) \
584 () EV_THROW () \ 572 () throw () \
585 { \ 573 { \
586 } 574 }
587 #endif 575 #endif
588 576
589 /* using a template here would require quite a bit more lines, 577 /* using a template here would require quite a bit more lines,
590 * so a macro solution was chosen */ 578 * so a macro solution was chosen */
591 #define EV_BEGIN_WATCHER(cppstem,cstem) \ 579 #define EV_BEGIN_WATCHER(cppstem,cstem) \
592 \ 580 \
593 struct cppstem : base<ev_ ## cstem, cppstem> \ 581 struct cppstem : base<ev_ ## cstem, cppstem> \
594 { \ 582 { \
595 void start () EV_THROW () \ 583 void start () throw () \
596 { \ 584 { \
597 ev_ ## cstem ## _start (EV_A_ static_cast<ev_ ## cstem *>(this)); \ 585 ev_ ## cstem ## _start (EV_A_ static_cast<ev_ ## cstem *>(this)); \
598 } \ 586 } \
599 \ 587 \
600 void stop () EV_THROW () \ 588 void stop () throw () \
601 { \ 589 { \
602 ev_ ## cstem ## _stop (EV_A_ static_cast<ev_ ## cstem *>(this)); \ 590 ev_ ## cstem ## _stop (EV_A_ static_cast<ev_ ## cstem *>(this)); \
603 } \ 591 } \
604 \ 592 \
605 cppstem EV_CONSTRUCT(cppstem,cstem) \ 593 cppstem EV_CONSTRUCT(cppstem,cstem) \
606 \ 594 \
607 ~cppstem () EV_THROW () \ 595 ~cppstem () throw () \
608 { \ 596 { \
609 stop (); \ 597 stop (); \
610 } \ 598 } \
611 \ 599 \
612 using base<ev_ ## cstem, cppstem>::set; \ 600 using base<ev_ ## cstem, cppstem>::set; \
621 609
622 #define EV_END_WATCHER(cppstem,cstem) \ 610 #define EV_END_WATCHER(cppstem,cstem) \
623 }; 611 };
624 612
625 EV_BEGIN_WATCHER (io, io) 613 EV_BEGIN_WATCHER (io, io)
626 void set (int fd, int events) EV_THROW () 614 void set (int fd, int events) throw ()
627 { 615 {
628 int active = is_active (); 616 int active = is_active ();
629 if (active) stop (); 617 if (active) stop ();
630 ev_io_set (static_cast<ev_io *>(this), fd, events); 618 ev_io_set (static_cast<ev_io *>(this), fd, events);
631 if (active) start (); 619 if (active) start ();
632 } 620 }
633 621
634 void set (int events) EV_THROW () 622 void set (int events) throw ()
635 { 623 {
636 int active = is_active (); 624 int active = is_active ();
637 if (active) stop (); 625 if (active) stop ();
638 ev_io_set (static_cast<ev_io *>(this), fd, events); 626 ev_io_set (static_cast<ev_io *>(this), fd, events);
639 if (active) start (); 627 if (active) start ();
640 } 628 }
641 629
642 void start (int fd, int events) EV_THROW () 630 void start (int fd, int events) throw ()
643 { 631 {
644 set (fd, events); 632 set (fd, events);
645 start (); 633 start ();
646 } 634 }
647 EV_END_WATCHER (io, io) 635 EV_END_WATCHER (io, io)
648 636
649 EV_BEGIN_WATCHER (timer, timer) 637 EV_BEGIN_WATCHER (timer, timer)
650 void set (ev_tstamp after, ev_tstamp repeat = 0.) EV_THROW () 638 void set (ev_tstamp after, ev_tstamp repeat = 0.) throw ()
651 { 639 {
652 int active = is_active (); 640 int active = is_active ();
653 if (active) stop (); 641 if (active) stop ();
654 ev_timer_set (static_cast<ev_timer *>(this), after, repeat); 642 ev_timer_set (static_cast<ev_timer *>(this), after, repeat);
655 if (active) start (); 643 if (active) start ();
656 } 644 }
657 645
658 void start (ev_tstamp after, ev_tstamp repeat = 0.) EV_THROW () 646 void start (ev_tstamp after, ev_tstamp repeat = 0.) throw ()
659 { 647 {
660 set (after, repeat); 648 set (after, repeat);
661 start (); 649 start ();
662 } 650 }
663 651
664 void again () EV_THROW () 652 void again () throw ()
665 { 653 {
666 ev_timer_again (EV_A_ static_cast<ev_timer *>(this)); 654 ev_timer_again (EV_A_ static_cast<ev_timer *>(this));
667 } 655 }
668 EV_END_WATCHER (timer, timer) 656 EV_END_WATCHER (timer, timer)
669 657
670 #if EV_PERIODIC_ENABLE 658 #if EV_PERIODIC_ENABLE
671 EV_BEGIN_WATCHER (periodic, periodic) 659 EV_BEGIN_WATCHER (periodic, periodic)
672 void set (ev_tstamp at, ev_tstamp interval = 0.) EV_THROW () 660 void set (ev_tstamp at, ev_tstamp interval = 0.) throw ()
673 { 661 {
674 int active = is_active (); 662 int active = is_active ();
675 if (active) stop (); 663 if (active) stop ();
676 ev_periodic_set (static_cast<ev_periodic *>(this), at, interval, 0); 664 ev_periodic_set (static_cast<ev_periodic *>(this), at, interval, 0);
677 if (active) start (); 665 if (active) start ();
678 } 666 }
679 667
680 void start (ev_tstamp at, ev_tstamp interval = 0.) EV_THROW () 668 void start (ev_tstamp at, ev_tstamp interval = 0.) throw ()
681 { 669 {
682 set (at, interval); 670 set (at, interval);
683 start (); 671 start ();
684 } 672 }
685 673
686 void again () EV_THROW () 674 void again () throw ()
687 { 675 {
688 ev_periodic_again (EV_A_ static_cast<ev_periodic *>(this)); 676 ev_periodic_again (EV_A_ static_cast<ev_periodic *>(this));
689 } 677 }
690 EV_END_WATCHER (periodic, periodic) 678 EV_END_WATCHER (periodic, periodic)
691 #endif 679 #endif
692 680
693 EV_BEGIN_WATCHER (sig, signal) 681 EV_BEGIN_WATCHER (sig, signal)
694 void set (int signum) EV_THROW () 682 void set (int signum) throw ()
695 { 683 {
696 int active = is_active (); 684 int active = is_active ();
697 if (active) stop (); 685 if (active) stop ();
698 ev_signal_set (static_cast<ev_signal *>(this), signum); 686 ev_signal_set (static_cast<ev_signal *>(this), signum);
699 if (active) start (); 687 if (active) start ();
700 } 688 }
701 689
702 void start (int signum) EV_THROW () 690 void start (int signum) throw ()
703 { 691 {
704 set (signum); 692 set (signum);
705 start (); 693 start ();
706 } 694 }
707 EV_END_WATCHER (sig, signal) 695 EV_END_WATCHER (sig, signal)
708 696
709 EV_BEGIN_WATCHER (child, child) 697 EV_BEGIN_WATCHER (child, child)
710 void set (int pid) EV_THROW () 698 void set (int pid) throw ()
711 { 699 {
712 int active = is_active (); 700 int active = is_active ();
713 if (active) stop (); 701 if (active) stop ();
714 ev_child_set (static_cast<ev_child *>(this), pid); 702 ev_child_set (static_cast<ev_child *>(this), pid);
715 if (active) start (); 703 if (active) start ();
716 } 704 }
717 705
718 void start (int pid) EV_THROW () 706 void start (int pid) throw ()
719 { 707 {
720 set (pid); 708 set (pid);
721 start (); 709 start ();
722 } 710 }
723 EV_END_WATCHER (child, child) 711 EV_END_WATCHER (child, child)
724 712
725 #if EV_STAT_ENABLE 713 #if EV_STAT_ENABLE
726 EV_BEGIN_WATCHER (stat, stat) 714 EV_BEGIN_WATCHER (stat, stat)
727 void set (const char *path, ev_tstamp interval = 0.) EV_THROW () 715 void set (const char *path, ev_tstamp interval = 0.) throw ()
728 { 716 {
729 int active = is_active (); 717 int active = is_active ();
730 if (active) stop (); 718 if (active) stop ();
731 ev_stat_set (static_cast<ev_stat *>(this), path, interval); 719 ev_stat_set (static_cast<ev_stat *>(this), path, interval);
732 if (active) start (); 720 if (active) start ();
733 } 721 }
734 722
735 void start (const char *path, ev_tstamp interval = 0.) EV_THROW () 723 void start (const char *path, ev_tstamp interval = 0.) throw ()
736 { 724 {
737 stop (); 725 stop ();
738 set (path, interval); 726 set (path, interval);
739 start (); 727 start ();
740 } 728 }
741 729
742 void update () EV_THROW () 730 void update () throw ()
743 { 731 {
744 ev_stat_stat (EV_A_ static_cast<ev_stat *>(this)); 732 ev_stat_stat (EV_A_ static_cast<ev_stat *>(this));
745 } 733 }
746 EV_END_WATCHER (stat, stat) 734 EV_END_WATCHER (stat, stat)
747 #endif 735 #endif
748 736
749 EV_BEGIN_WATCHER (idle, idle) 737 EV_BEGIN_WATCHER (idle, idle)
750 void set () EV_THROW () { } 738 void set () throw () { }
751 EV_END_WATCHER (idle, idle) 739 EV_END_WATCHER (idle, idle)
752 740
753 EV_BEGIN_WATCHER (prepare, prepare) 741 EV_BEGIN_WATCHER (prepare, prepare)
754 void set () EV_THROW () { } 742 void set () throw () { }
755 EV_END_WATCHER (prepare, prepare) 743 EV_END_WATCHER (prepare, prepare)
756 744
757 EV_BEGIN_WATCHER (check, check) 745 EV_BEGIN_WATCHER (check, check)
758 void set () EV_THROW () { } 746 void set () throw () { }
759 EV_END_WATCHER (check, check) 747 EV_END_WATCHER (check, check)
760 748
761 #if EV_EMBED_ENABLE 749 #if EV_EMBED_ENABLE
762 EV_BEGIN_WATCHER (embed, embed) 750 EV_BEGIN_WATCHER (embed, embed)
763 void start (struct ev_loop *embedded_loop) EV_THROW () 751 void start (struct ev_loop *embedded_loop) throw ()
764 { 752 {
765 stop (); 753 stop ();
766 ev_embed_set (static_cast<ev_embed *>(this), embedded_loop); 754 ev_embed_set (static_cast<ev_embed *>(this), embedded_loop);
767 start (); 755 start ();
768 } 756 }
774 EV_END_WATCHER (embed, embed) 762 EV_END_WATCHER (embed, embed)
775 #endif 763 #endif
776 764
777 #if EV_FORK_ENABLE 765 #if EV_FORK_ENABLE
778 EV_BEGIN_WATCHER (fork, fork) 766 EV_BEGIN_WATCHER (fork, fork)
779 void set () EV_THROW () { } 767 void set () throw () { }
780 EV_END_WATCHER (fork, fork) 768 EV_END_WATCHER (fork, fork)
781 #endif 769 #endif
782 770
783 #undef EV_PX 771 #undef EV_PX
784 #undef EV_PX_ 772 #undef EV_PX_

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines