Skip to content

Commit

Permalink
Fix test vulnerable to spurious condvar wakeups
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jan 2, 2018
1 parent 89939e1 commit 949306e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions t/concurrency/02-lock.t
Expand Up @@ -106,7 +106,9 @@ my class CondVar is repr('ConditionVariable') { }
my $t1 := nqp::newthread({
nqp::lock($l);
nqp::push(@log, 'ale');
nqp::condwait($c);
until nqp::elems(@log) == 2 {
nqp::condwait($c);
}
nqp::push(@log, 'stout');
nqp::condsignalall($c);
$now1 := nqp::time_n();
Expand All @@ -125,7 +127,9 @@ my class CondVar is repr('ConditionVariable') { }
nqp::lock($l);
nqp::push(@log, 'porter');
nqp::condsignalone($c);
nqp::condwait($c);
until nqp::elems(@log) == 3 {
nqp::condwait($c);
}
nqp::push(@log, 'lager');
nqp::unlock($l);
}, 0);
Expand Down

0 comments on commit 949306e

Please sign in to comment.