Skip to content

Commit 792f7a8

Browse files
committed
Add diag message for thread running *after* join
1 parent 3ff5fbb commit 792f7a8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

S17-concurrency/lock.t

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,16 @@ plan 7;
5252
{
5353
my $l = Lock.new;
5454
my $c = $l.condition;
55+
my $now1;
56+
my $now2 = now;
5557
my @log;
5658

5759
my $t1 = Thread.start({
5860
$l.protect({
5961
@log.push('ale');
6062
$c.wait();
6163
@log.push('stout');
64+
$now1 = now;
6265
});
6366
});
6467

@@ -72,8 +75,9 @@ plan 7;
7275
});
7376

7477
$t1.join();
78+
$now2 = now;
7579
$t2.join();
7680

77-
diag "log = {@log}" if !
81+
diag "log = {@log}{ $now1>$now2 ?? ', thread was running *after* join' !! ''}" if !
7882
is @log.join(','), 'ale,porter,stout', 'Condition variable worked';
7983
}

0 commit comments

Comments
 (0)