… | |
… | |
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 | |