… | |
… | |
60 | package EV; |
60 | package EV; |
61 | |
61 | |
62 | use strict; |
62 | use strict; |
63 | |
63 | |
64 | BEGIN { |
64 | BEGIN { |
65 | our $VERSION = '0.1'; |
65 | our $VERSION = '0.5'; |
66 | use XSLoader; |
66 | use XSLoader; |
67 | XSLoader::load "EV", $VERSION; |
67 | XSLoader::load "EV", $VERSION; |
68 | } |
68 | } |
69 | |
69 | |
70 | @EV::Io::ISA = |
70 | @EV::Io::ISA = |
… | |
… | |
150 | In the rare case where one wants to create a watcher but not start it at |
150 | In the rare case where one wants to create a watcher but not start it at |
151 | the same time, each constructor has a variant with a trailing C<_ns> in |
151 | the same time, each constructor has a variant with a trailing C<_ns> in |
152 | its name, e.g. EV::io has a non-starting variant EV::io_ns and so on. |
152 | its name, e.g. EV::io has a non-starting variant EV::io_ns and so on. |
153 | |
153 | |
154 | Please note that a watcher will automatically be stopped when the watcher |
154 | Please note that a watcher will automatically be stopped when the watcher |
155 | object is returned, so you I<need> to keep the watcher objects returned by |
155 | object is destroyed, so you I<need> to keep the watcher objects returned by |
156 | the constructors. |
156 | the constructors. |
|
|
157 | |
|
|
158 | Also, all methods changing some aspect of a watcher (->set, ->priority, |
|
|
159 | ->fh and so on) automatically stop and start it again if it is active, |
|
|
160 | which means pending events get lost. |
157 | |
161 | |
158 | =head2 WATCHER TYPES |
162 | =head2 WATCHER TYPES |
159 | |
163 | |
160 | Now lets move to the existing watcher types and asociated methods. |
164 | Now lets move to the existing watcher types and asociated methods. |
161 | |
165 | |
… | |
… | |
184 | |
188 | |
185 | =item $current_cb = $w->cb |
189 | =item $current_cb = $w->cb |
186 | |
190 | |
187 | =item $old_cb = $w->cb ($new_cb) |
191 | =item $old_cb = $w->cb ($new_cb) |
188 | |
192 | |
189 | Queries the callback on the watcher and optionally changes it. You cna do |
193 | Queries the callback on the watcher and optionally changes it. You can do |
190 | this at any time. |
194 | this at any time without the watcher restarting. |
|
|
195 | |
|
|
196 | =item $current_priority = $w->priority |
|
|
197 | |
|
|
198 | =item $old_priority = $w->priority ($new_priority) |
|
|
199 | |
|
|
200 | Queries the priority on the watcher and optionally changes it. Pending |
|
|
201 | watchers with higher priority will be invoked first. The valid range of |
|
|
202 | priorities lies between EV::MAXPRI (default 2) and EV::MINPRI (default |
|
|
203 | -2). If the priority is outside this range it will automatically be |
|
|
204 | normalised to the nearest valid priority. |
|
|
205 | |
|
|
206 | The default priority of any newly-created weatcher is 0. |
191 | |
207 | |
192 | =item $w->trigger ($revents) |
208 | =item $w->trigger ($revents) |
193 | |
209 | |
194 | Call the callback *now* with the given event mask. |
210 | Call the callback *now* with the given event mask. |
195 | |
211 | |
… | |
… | |
323 | =item $w->set ($signal) |
339 | =item $w->set ($signal) |
324 | |
340 | |
325 | Reconfigures the watcher, see the constructor above for details. Can be at |
341 | Reconfigures the watcher, see the constructor above for details. Can be at |
326 | any time. |
342 | any time. |
327 | |
343 | |
|
|
344 | =item $current_signum = $w->signal |
|
|
345 | |
|
|
346 | =item $old_signum = $w->signal ($new_signal) |
|
|
347 | |
|
|
348 | Returns the previously set signal (always as a number not name) and |
|
|
349 | optionally set a new one. |
|
|
350 | |
328 | |
351 | |
329 | =item $w = EV::child $pid, $callback |
352 | =item $w = EV::child $pid, $callback |
330 | |
353 | |
331 | =item $w = EV::child_ns $pid, $callback |
354 | =item $w = EV::child_ns $pid, $callback |
332 | |
355 | |
… | |
… | |
345 | |
368 | |
346 | =item $w->set ($pid) |
369 | =item $w->set ($pid) |
347 | |
370 | |
348 | Reconfigures the watcher, see the constructor above for details. Can be at |
371 | Reconfigures the watcher, see the constructor above for details. Can be at |
349 | any time. |
372 | any time. |
|
|
373 | |
|
|
374 | =item $current_pid = $w->pid |
|
|
375 | |
|
|
376 | =item $old_pid = $w->pid ($new_pid) |
|
|
377 | |
|
|
378 | Returns the previously set process id and optionally set a new one. |
350 | |
379 | |
351 | |
380 | |
352 | =item $w = EV::idle $callback |
381 | =item $w = EV::idle $callback |
353 | |
382 | |
354 | =item $w = EV::idle_ns $callback |
383 | =item $w = EV::idle_ns $callback |