Changeset 074bdaa for perl


Ignore:
Timestamp:
Jun 22, 2011, 12:37:21 AM (13 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.8, release-1.9
Children:
bcde7926
Parents:
58f4fb2
git-author:
David Benjamin <davidben@mit.edu> (05/24/11 00:36:51)
git-committer:
David Benjamin <davidben@mit.edu> (06/22/11 00:37:21)
Message:
Replace BarnOwl::Timer with a perl wrapper over AnyEvent

This also allows us to kill owl_timer altogether.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • perl/lib/BarnOwl/Timer.pm

    rc6adf17 r074bdaa  
    33
    44package BarnOwl::Timer;
     5
     6use AnyEvent;
    57
    68sub new {
     
    1315    my $self = {cb => $cb};
    1416
    15     my $name = $args->{name};
    16     $name = "(unnamed)" unless defined $name;
    17 
    1817    bless($self, $class);
    1918
    20     $self->{timer} = BarnOwl::Internal::add_timer($args->{after} || 0,
    21                                                   $args->{interval} || 0,
    22                                                   $self,
    23                                                   $name);
     19    $self->{timer} = AnyEvent->timer(%$args);
    2420    return $self;
    2521}
     
    2723sub stop {
    2824    my $self = shift;
    29     if(defined($self->{timer})) {
    30         BarnOwl::Internal::remove_timer($self->{timer});
    31         undef $self->{timer};
    32     }
     25    undef $self->{timer};
    3326}
    3427
Note: See TracChangeset for help on using the changeset viewer.