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

Comparing EV/EV.pm (file contents):
Revision 1.44 by root, Thu Nov 22 04:52:23 2007 UTC vs.
Revision 1.45 by root, Fri Nov 23 03:59:23 2007 UTC

493 # do nothing unless active 493 # do nothing unless active
494 $dispatcher->{_event_queue_h} 494 $dispatcher->{_event_queue_h}
495 or return; 495 or return;
496 496
497 # make the dispatcher handle any outstanding stuff 497 # make the dispatcher handle any outstanding stuff
498 ... not shown
498 499
499 # create an IO watcher for each and every socket 500 # create an IO watcher for each and every socket
500 @snmp_watcher = ( 501 @snmp_watcher = (
501 (map { EV::io $_, EV::READ, sub { } } 502 (map { EV::io $_, EV::READ, sub { } }
502 keys %{ $dispatcher->{_descriptors} }), 503 keys %{ $dispatcher->{_descriptors} }),
504
505 EV::timer +($event->[Net::SNMP::Dispatcher::_ACTIVE]
506 ? $event->[Net::SNMP::Dispatcher::_TIME] - EV::now : 0),
507 0, sub { },
503 ); 508 );
504
505 # if there are any timeouts, also create a timer
506 push @snmp_watcher, EV::timer $event->[Net::SNMP::Dispatcher::_TIME] - EV::now, 0, sub { }
507 if $event->[Net::SNMP::Dispatcher::_ACTIVE];
508 }; 509 };
509 510
510The callbacks are irrelevant, the only purpose of those watchers is 511The callbacks are irrelevant (and are not even being called), the
511to wake up the process as soon as one of those events occurs (socket 512only purpose of those watchers is to wake up the process as soon as
512readable, or timer timed out). The corresponding EV::check watcher will then 513one of those events occurs (socket readable, or timer timed out). The
513clean up: 514corresponding EV::check watcher will then clean up:
514 515
515 our $snmp_check = EV::check sub { 516 our $snmp_check = EV::check sub {
516 # destroy all watchers 517 # destroy all watchers
517 @snmp_watcher = (); 518 @snmp_watcher = ();
518 519
519 # make the dispatcher handle any new stuff 520 # make the dispatcher handle any new stuff
521 ... not shown
520 }; 522 };
521 523
522The callbacks of the created watchers will not be called as the watchers 524The callbacks of the created watchers will not be called as the watchers
523are destroyed before this cna happen (remember EV::check gets called 525are destroyed before this cna happen (remember EV::check gets called
524first). 526first).
527 529
528=back 530=back
529 531
530=head1 THREADS 532=head1 THREADS
531 533
532Threads are not supported by this in any way. Perl pseudo-threads is evil 534Threads are not supported by this module in any way. Perl pseudo-threads
533stuff and must die. 535is evil stuff and must die.
534 536
535=cut 537=cut
536 538
537our $DIED = sub { 539our $DIED = sub {
538 warn "EV: error in callback (ignoring): $@"; 540 warn "EV: error in callback (ignoring): $@";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines