- Timestamp:
- Jun 22, 2011, 12:37:21 AM (14 years ago)
- Branches:
- master, release-1.10, release-1.8, release-1.9
- Children:
- bbb7876
- Parents:
- 074bdaa
- git-author:
- David Benjamin <davidben@mit.edu> (05/24/11 01:10:12)
- git-committer:
- David Benjamin <davidben@mit.edu> (06/22/11 00:37:21)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
perl/lib/BarnOwl.pm
r9179fd7 rbcde7926 166 166 read from C<FD>. 167 167 168 C<add_dispatch> has been deprecated in favor of C<add_io_dispatch>, 169 and is now a wrapper for it called with C<mode> set to C<'r'>. 168 C<add_dispatch> has been deprecated in favor of C<AnyEvent>, and is 169 now a wrapper for C<add_io_dispatch> called with C<mode> set to 170 C<'r'>. 170 171 171 172 =cut … … 181 182 Remove a file descriptor previously registered via C<add_dispatch> 182 183 183 C<remove_dispatch> has been deprecated in favor of 184 C<remove_io_dispatch>. 184 C<remove_dispatch> has been deprecated in favor of C<AnyEvent>. 185 185 186 186 =cut … … 197 197 registered, the old one is removed. 198 198 199 =cut 199 C<add_io_dispatch> has been deprecated in favor of C<AnyEvent>. 200 201 =cut 202 203 our %_io_dispatches; 200 204 201 205 sub add_io_dispatch { … … 203 207 my $modeStr = shift; 204 208 my $cb = shift; 205 my $mode = 0; 206 207 $mode |= 0x1 if ($modeStr =~ /r/i); # Read 208 $mode |= 0x2 if ($modeStr =~ /w/i); # Write 209 if ($mode) { 210 $mode |= 0x4; # Exceptional 211 BarnOwl::Internal::add_io_dispatch($fd, $mode, $cb); 209 my @modes; 210 211 push @modes, 'r' if $modeStr =~ /r/i; # Read 212 push @modes, 'w' if $modeStr =~ /w/i; # Write 213 if (@modes) { 214 BarnOwl::remove_io_dispatch($fd); 215 for my $mode (@modes) { 216 push @{$_io_dispatches{$fd}}, AnyEvent->io(fh => $fd, 217 poll => $mode, 218 cb => $cb); 219 } 212 220 } else { 213 221 die("Invalid I/O Dispatch mode: $modeStr"); … … 218 226 219 227 Remove a file descriptor previously registered via C<add_io_dispatch> 228 229 C<remove_io_dispatch> has been deprecated in favor of C<AnyEvent>. 230 231 =cut 232 233 sub remove_io_dispatch { 234 my $fd = shift; 235 undef $_ foreach @{$_io_dispatches{$fd}}; 236 delete $_io_dispatches{$fd}; 237 } 220 238 221 239 =head2 create_style NAME OBJECT
Note: See TracChangeset
for help on using the changeset viewer.