ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent-Watchdog/Watchdog/Util.pm
(Generate patch)

Comparing AnyEvent-Watchdog/Watchdog/Util.pm (file contents):
Revision 1.4 by root, Tue Sep 1 16:33:34 2009 UTC vs.
Revision 1.5 by root, Wed Sep 2 14:02:32 2009 UTC

55 55
56sub enabled() { 56sub enabled() {
57 $AnyEvent::Watchdog::ENABLED 57 $AnyEvent::Watchdog::ENABLED
58} 58}
59 59
60=item AnyEvent::Watchdog::restart_in [$timeout] 60=item AnyEvent::Watchdog::Util::restart_in [$timeout]
61 61
62Tells the supervisor to restart the process when it exits (enable 62Tells the supervisor to restart the process when it exits (enable
63autorestart), or forcefully after C<$timeout> seconds (minimum 1, maximum 63autorestart), or forcefully after C<$timeout> seconds (minimum 1, maximum
64255, default 60). 64255, default 60).
65 65
87 87
88 # now make sure we dont' send it any further requests 88 # now make sure we dont' send it any further requests
89 our $OLD_C = $C; undef $C; 89 our $OLD_C = $C; undef $C;
90} 90}
91 91
92=item AnyEvent::Watchdog::restart [$timeout] 92=item AnyEvent::Watchdog::Util::restart [$timeout]
93 93
94Just like C<restart_in>, but also calls C<exit 0>. This means that this is 94Just like C<restart_in>, but also calls C<exit 0>. This means that this is
95the ideal method to force a restart. 95the ideal method to force a restart.
96 96
97=cut 97=cut
130 } 130 }
131 131
132 syswrite $C, $AUTORESTART ? "\x01" : "\x00"; 132 syswrite $C, $AUTORESTART ? "\x01" : "\x00";
133} 133}
134 134
135=item AnyEvent::Watchdog::heartbeat [$interval] 135=item AnyEvent::Watchdog::Util::heartbeat [$interval]
136 136
137=item use AnyEvent::Watchdog heartbeat => $interval 137=item use AnyEvent::Watchdog heartbeat => $interval
138 138
139Tells the supervisor to automatically kill the program if it doesn't 139Tells the supervisor to automatically kill the program if it doesn't
140react for C<$interval> seconds (minium 1, maximum 255, default 60) , then 140react for C<$interval> seconds (minium 1, maximum 255, default 60) , then
170 syswrite $C, "\x04" 170 syswrite $C, "\x04"
171 if $C; 171 if $C;
172 }; 172 };
173} 173}
174 174
175=item AnyEvent::Watchdog::on_exit { BLOCK; shift->() } 175=item AnyEvent::Watchdog::Util::on_exit { BLOCK; shift->() }
176 176
177Installs an exit hook that is executed when the program is about to exit, 177Installs an exit hook that is executed when the program is about to exit,
178while event processing is still active to some extent. 178while event processing is still active to some extent.
179 179
180The hook should do whatever it needs to do (close active connections, 180The hook should do whatever it needs to do (close active connections,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines