Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 3814ab3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/core/ThreadPoolScheduler.pm
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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;
}
}
Expand Down

0 comments on commit 3814ab3

Please sign in to comment.