Permalink
Browse files

Pass an arg for the async handle to nqp::timer.

It's already required on Moar in order to use nqp::timer at all. Will
need some JVM work to get this in place also.
  • Loading branch information...
jnthn committed Apr 18, 2014
1 parent a71eccd commit 3814ab3346926c0ae845af48efe1eb607156f787
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/core/ThreadPoolScheduler.pm
@@ -50,7 +50,10 @@ my class ThreadPoolScheduler does Scheduler {
die "Initial thread pool threads must be less than or equal to maximum threads"
if $!initial_threads > $!max_threads;
}
# This goes here for now, will be needed more widely soon.
my class AsyncCancellation is repr('AsyncTask') { }
method cue(&code, :$at, :$in, :$every, :$times = 1, :&catch ) {
die "Cannot specify :at and :in at the same time"
if $at.defined and $in.defined;
@@ -66,7 +69,7 @@ my class ThreadPoolScheduler does Scheduler {
?? -> { code(); CATCH { default { catch($_) } } }
!! -> { code() },
($delay * 1000).Int, ($every * 1000).Int,
Mu); # XXX TODO: cancellation token
AsyncCancellation);
}
# only after waiting a bit or more than once
@@ -76,7 +79,7 @@ my class ThreadPoolScheduler does Scheduler {
!! -> { code() };
for 1 .. $times {
nqp::timer($!queue, $todo, ($delay * 1000).Int, 0,
Mu); # XXX TODO: cancellation token
AsyncCancellation);
$delay = 0;
}
}

0 comments on commit 3814ab3

Please sign in to comment.