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

Comparing AnyEvent/lib/AnyEvent.pm (file contents):
Revision 1.164 by root, Tue Jul 8 19:50:25 2008 UTC vs.
Revision 1.166 by root, Tue Jul 8 23:10:20 2008 UTC

152=head2 I/O WATCHERS 152=head2 I/O WATCHERS
153 153
154You can create an I/O watcher by calling the C<< AnyEvent->io >> method 154You can create an I/O watcher by calling the C<< AnyEvent->io >> method
155with the following mandatory key-value pairs as arguments: 155with the following mandatory key-value pairs as arguments:
156 156
157C<fh> the Perl I<file handle> (I<not> file descriptor) to watch 157C<fh> the Perl I<file handle> (I<not> file descriptor) to watch for events
158for events. C<poll> must be a string that is either C<r> or C<w>, 158(AnyEvent might or might not keep a reference to this file handle). C<poll>
159which creates a watcher waiting for "r"eadable or "w"ritable events, 159must be a string that is either C<r> or C<w>, which creates a watcher
160respectively. C<cb> is the callback to invoke each time the file handle 160waiting for "r"eadable or "w"ritable events, respectively. C<cb> is the
161becomes ready. 161callback to invoke each time the file handle becomes ready.
162 162
163Although the callback might get passed parameters, their value and 163Although the callback might get passed parameters, their value and
164presence is undefined and you cannot rely on them. Portable AnyEvent 164presence is undefined and you cannot rely on them. Portable AnyEvent
165callbacks cannot use arguments passed to I/O watcher callbacks. 165callbacks cannot use arguments passed to I/O watcher callbacks.
166 166
193Although the callback might get passed parameters, their value and 193Although the callback might get passed parameters, their value and
194presence is undefined and you cannot rely on them. Portable AnyEvent 194presence is undefined and you cannot rely on them. Portable AnyEvent
195callbacks cannot use arguments passed to time watcher callbacks. 195callbacks cannot use arguments passed to time watcher callbacks.
196 196
197The callback will normally be invoked once only. If you specify another 197The callback will normally be invoked once only. If you specify another
198parameter, C<interval>, as a positive number, then the callback will be 198parameter, C<interval>, as a strictly positive number (> 0), then the
199invoked regularly at that interval (in fractional seconds) after the first 199callback will be invoked regularly at that interval (in fractional
200invocation. 200seconds) after the first invocation. If C<interval> is specified with a
201false value, then it is treated as if it were missing.
201 202
202The callback will be rescheduled before invoking the callback, but no 203The callback will be rescheduled before invoking the callback, but no
203attempt is done to avoid timer drift in most backends, so the interval is 204attempt is done to avoid timer drift in most backends, so the interval is
204only approximate. 205only approximate.
205 206

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines