summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2005-05-12 19:07:27 +0000
committerDave Mitchell <davem@fdisolutions.com>2005-05-12 19:07:27 +0000
commitd94cde48b58209946d142fc5018969fd2b8285e8 (patch)
tree74a0234c33e92ac560aca218b8a814b1ac845bfe
parent939d5c9d7fd5daa1517af4234ad971505e83f908 (diff)
downloadperl-d94cde48b58209946d142fc5018969fd2b8285e8.tar.gz
make join.t threadsafe!
tests 13 and 14 could output in reverse order. Add a lock to stop this. p4raw-id: //depot/perl@24455
-rw-r--r--ext/threads/t/join.t3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/threads/t/join.t b/ext/threads/t/join.t
index 472d1d206d..dbd64487de 100644
--- a/ext/threads/t/join.t
+++ b/ext/threads/t/join.t
@@ -25,6 +25,8 @@ use Devel::Peek qw(Dump);
sub ok {
my ($ok, $name) = @_;
+ lock $test_id; # make print and increment atomic
+
# You have to do it this way or VMS will get confused.
print $ok ? "ok $test_id - $name\n" : "not ok $test_id - $name\n";
@@ -149,6 +151,7 @@ if ($^O eq 'linux') {
# purpose is to incite a lot of calls to newCONSTSUB. See the p5p
# archives for the thread "maint@20974 or before broke mp2 ithreads test".
use IO::File;
+ # this coredumped between #20930 and #21000
$_->join for map threads->new(sub{ok($_, "stress newCONSTSUB")}), 1..2;
}