Subject: | unexpected behaviour |
Why obj lambda is runned, it is not expected.
Also notice - it is runned but is not finished completely.
Two bugs =(
Subject: | test.pl |
#!/usr/bin/perl
use IO::Lambda qw(:constants);
my $obj = IO::Lambda-> new;
# Either 3 or time + 3 will do. See "Time" section for more info
$obj-> watch_timer( 3, sub { print "I've slept 3 seconds!\n" });
$obj-> watch_io( IO_READ, \*STDIN, 15, sub {
my ( $self, $ok) = @_;
print $ok ?
"stdin is readable!\n" :
"stdin is not readable within 5 seconds\n";
});
my $a = IO::Lambda-> new;
$a-> watch_timer( 3, sub { print "3 seconds!\n" });
my $b = IO::Lambda-> new;
# A lambda can wait for more than one event or lambda.
# A lambda can be awaited by more than one lambda.
$b-> watch_lambda( $a, sub { print "lambda #1 is finished!\n"});
#IO::Lambda::run;
#IO::Lambda::run;
$b->wait;