Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'nom' of github.com:rakudo/rakudo into nom
  • Loading branch information
moritz committed Nov 5, 2013
2 parents 069dc3a + 215ba6a commit 1607bc4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
29 changes: 26 additions & 3 deletions src/vm/jvm/core/Threading.pm
Expand Up @@ -781,7 +781,7 @@ my class SubscribableOperations is repr('Uninstantiable') {
my $sub = self.Subscribable::subscribe(|c);
my $ssn = $!source.subscribe(
-> \val {
if (filter(val)) { self!next(val) }
if (&!filter(val)) { self!next(val) }
},
{ self!last(); },
-> $ex { self!fail($ex) }
Expand All @@ -803,7 +803,7 @@ my class SubscribableOperations is repr('Uninstantiable') {
my $sub = self.Subscribable::subscribe(|c);
my $ssn = $!source.subscribe(
-> \val {
self!next(mapper(val))
self!next(&!mapper(val))
},
{ self!last(); },
-> $ex { self!fail($ex) }
Expand Down Expand Up @@ -903,6 +903,29 @@ my class Publish {
}
ForSubscribable.new(:@values, :$scheduler)
}

method interval($interval, $delay = 0, :$scheduler = $*SCHEDULER) {
my class IntervalSubscribable does Subscribable {
has $!scheduler;
has $!interval;
has $!delay;

submethod BUILD(:$!scheduler, :$!interval, :$!delay) {}

method subscribe(|c) {
my $sub = self.Subscribable::subscribe(|c);
$!scheduler.schedule_every(
{
state $i = 0;
$sub.next().($i++);
},
$!interval, $!delay
);
$sub
}
}
IntervalSubscribable.new(:$interval, :$delay, :$scheduler)
}
}

# A KeyReducer provides a thread-safe way to compose a hash from multiple
Expand Down Expand Up @@ -1025,7 +1048,7 @@ my class IO::Async::File {
nqp::p6bool(nqp::istrue($!PIO));
}

method slurp(:$bin, :enc($encoding)) {
method slurp(IO::Async::File:D: :$bin, :enc($encoding)) {
self.open(:r, :$bin) unless self.opened;
self.encoding($encoding) if $encoding.defined;

Expand Down
2 changes: 1 addition & 1 deletion tools/build/NQP_REVISION
@@ -1 +1 @@
2013.10-166-g54f6198
2013.10-178-gf42871d

0 comments on commit 1607bc4

Please sign in to comment.