… | |
… | |
104 | |
104 | |
105 | Create and return a watcher of the given type. |
105 | Create and return a watcher of the given type. |
106 | |
106 | |
107 | Examples: |
107 | Examples: |
108 | |
108 | |
109 | my $reader = Coro::Event->io(fd => $filehandle, poll => 'r'); |
109 | my $reader = Coro::Event->io (fd => $filehandle, poll => 'r'); |
110 | $reader->next; |
110 | $reader->next; |
111 | |
111 | |
112 | =cut |
112 | =cut |
113 | |
113 | |
114 | =item $w->next |
114 | =item $w->next |
… | |
… | |
202 | Same as Event::unloop (provided here for your convinience only). |
202 | Same as Event::unloop (provided here for your convinience only). |
203 | |
203 | |
204 | =cut |
204 | =cut |
205 | |
205 | |
206 | # very inefficient |
206 | # very inefficient |
207 | our $event_idle = new Coro sub { |
207 | our $IDLE = new Coro sub { |
208 | while () { |
208 | while () { |
209 | &Event::one_event; |
209 | &Event::one_event; |
210 | &Coro::schedule; |
210 | &Coro::schedule; |
211 | } |
211 | } |
212 | }; |
212 | }; |
213 | $event_idle->{desc} = "[Event idle process]"; |
213 | $IDLE->{desc} = "[Event idle process]"; |
214 | |
214 | |
215 | $Coro::idle = sub { $event_idle->ready }; |
215 | $Coro::idle = $IDLE; |
216 | |
216 | |
217 | 1; |
217 | 1; |
218 | |
218 | |
219 | =back |
219 | =back |
220 | |
220 | |