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 | * |
… | |
… | |
672 | ev_periodic_again (EV_A_ static_cast<ev_periodic *>(this)); |
672 | ev_periodic_again (EV_A_ static_cast<ev_periodic *>(this)); |
673 | } |
673 | } |
674 | EV_END_WATCHER (periodic, periodic) |
674 | EV_END_WATCHER (periodic, periodic) |
675 | #endif |
675 | #endif |
676 | |
676 | |
|
|
677 | #if EV_SIGNAL_ENABLE |
677 | EV_BEGIN_WATCHER (sig, signal) |
678 | EV_BEGIN_WATCHER (sig, signal) |
678 | void set (int signum) throw () |
679 | void set (int signum) throw () |
679 | { |
680 | { |
680 | int active = is_active (); |
681 | int active = is_active (); |
681 | if (active) stop (); |
682 | if (active) stop (); |
… | |
… | |
687 | { |
688 | { |
688 | set (signum); |
689 | set (signum); |
689 | start (); |
690 | start (); |
690 | } |
691 | } |
691 | EV_END_WATCHER (sig, signal) |
692 | EV_END_WATCHER (sig, signal) |
|
|
693 | #endif |
692 | |
694 | |
|
|
695 | #if EV_CHILD_ENABLE |
693 | EV_BEGIN_WATCHER (child, child) |
696 | EV_BEGIN_WATCHER (child, child) |
694 | void set (int pid, int trace = 0) throw () |
697 | void set (int pid, int trace = 0) throw () |
695 | { |
698 | { |
696 | int active = is_active (); |
699 | int active = is_active (); |
697 | if (active) stop (); |
700 | if (active) stop (); |
… | |
… | |
703 | { |
706 | { |
704 | set (pid, trace); |
707 | set (pid, trace); |
705 | start (); |
708 | start (); |
706 | } |
709 | } |
707 | EV_END_WATCHER (child, child) |
710 | EV_END_WATCHER (child, child) |
|
|
711 | #endif |
708 | |
712 | |
709 | #if EV_STAT_ENABLE |
713 | #if EV_STAT_ENABLE |
710 | EV_BEGIN_WATCHER (stat, stat) |
714 | EV_BEGIN_WATCHER (stat, stat) |
711 | void set (const char *path, ev_tstamp interval = 0.) throw () |
715 | void set (const char *path, ev_tstamp interval = 0.) throw () |
712 | { |
716 | { |
… | |
… | |
728 | ev_stat_stat (EV_A_ static_cast<ev_stat *>(this)); |
732 | ev_stat_stat (EV_A_ static_cast<ev_stat *>(this)); |
729 | } |
733 | } |
730 | EV_END_WATCHER (stat, stat) |
734 | EV_END_WATCHER (stat, stat) |
731 | #endif |
735 | #endif |
732 | |
736 | |
733 | #if EV_IDLE_ENABLE |
737 | #if EV_IDLE_ENABLE |
734 | EV_BEGIN_WATCHER (idle, idle) |
738 | EV_BEGIN_WATCHER (idle, idle) |
735 | void set () throw () { } |
739 | void set () throw () { } |
736 | EV_END_WATCHER (idle, idle) |
740 | EV_END_WATCHER (idle, idle) |
737 | #endif |
741 | #endif |
738 | |
742 | |
|
|
743 | #if EV_PREPARE_ENABLE |
739 | EV_BEGIN_WATCHER (prepare, prepare) |
744 | EV_BEGIN_WATCHER (prepare, prepare) |
740 | void set () throw () { } |
745 | void set () throw () { } |
741 | EV_END_WATCHER (prepare, prepare) |
746 | EV_END_WATCHER (prepare, prepare) |
|
|
747 | #endif |
742 | |
748 | |
|
|
749 | #if EV_CHECK_ENABLE |
743 | EV_BEGIN_WATCHER (check, check) |
750 | EV_BEGIN_WATCHER (check, check) |
744 | void set () throw () { } |
751 | void set () throw () { } |
745 | EV_END_WATCHER (check, check) |
752 | EV_END_WATCHER (check, check) |
|
|
753 | #endif |
746 | |
754 | |
747 | #if EV_EMBED_ENABLE |
755 | #if EV_EMBED_ENABLE |
748 | EV_BEGIN_WATCHER (embed, embed) |
756 | EV_BEGIN_WATCHER (embed, embed) |
749 | void set (struct ev_loop *embedded_loop) throw () |
757 | void set (struct ev_loop *embedded_loop) throw () |
750 | { |
758 | { |