Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix a problem with timed schedules and loads
We need to look at what .loads is actually supposed to do.
  • Loading branch information
lizmat committed Apr 23, 2014
1 parent 64f1110 commit 8983aa3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/core/ThreadPoolScheduler.pm
Expand Up @@ -32,6 +32,7 @@ my class ThreadPoolScheduler does Scheduler {
Thread.start(:app_lifetime, {
loop {
my Mu $task := nqp::shift($!queue);
$!loads_lock.protect: { $!loads = $!loads + 1 };
try {
if nqp::islist($task) {
my Mu $code := nqp::shift($task);
Expand Down Expand Up @@ -104,9 +105,7 @@ my class ThreadPoolScheduler does Scheduler {
my &run := &catch
?? -> { code(); CATCH { default { catch($_) } } }
!! &code;
my $loads = $!loads_lock.protect: { $!loads = $!loads + 1 };
self!maybe_new_thread()
if !$!started_any || $loads > 1;
self!maybe_new_thread() if !$!started_any || $!loads;
nqp::push($!queue, &run);
return Nil;
}
Expand Down

0 comments on commit 8983aa3

Please sign in to comment.