summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Bergman <sky@nanisky.com>2003-04-16 16:27:43 +0000
committerArtur Bergman <sky@nanisky.com>2003-04-16 16:27:43 +0000
commit57b48062fe99a8eadb0b080a32b9197986647f56 (patch)
tree8ea358aa705fd3cd5e565f023d45be9ff30ecdd8
parent79d9a4d753ef0c0dd9ae193f48a2f22228f03b23 (diff)
downloadperl-57b48062fe99a8eadb0b080a32b9197986647f56.tar.gz
Fix double join problem for those places where free
actually means free (solaris for example :) Fixes bug #16681 p4raw-id: //depot/perl@19240
-rw-r--r--ext/threads/t/join.t15
-rwxr-xr-xext/threads/threads.xs2
2 files changed, 15 insertions, 2 deletions
diff --git a/ext/threads/t/join.t b/ext/threads/t/join.t
index 28be717940..054d0fe61a 100644
--- a/ext/threads/t/join.t
+++ b/ext/threads/t/join.t
@@ -10,7 +10,7 @@ BEGIN {
use ExtUtils::testlib;
use strict;
-BEGIN { print "1..11\n" };
+BEGIN { print "1..12\n" };
use threads;
use threads::shared;
@@ -118,3 +118,16 @@ if ($^O eq 'linux') { # We parse ps output so this is OS-dependent.
} else {
skip("\$0 check: only on Linux");
}
+
+{
+ my $t = threads->new(sub {});
+ $t->join;
+ my $x = threads->new(sub {});
+ $x->join;
+ eval {
+ $t->join;
+ };
+ my $ok = 0;
+ $ok++ if($@ =~/Thread already joined/);
+ ok($ok, "Double join works");
+}
diff --git a/ext/threads/threads.xs b/ext/threads/threads.xs
index 1ad12a6f43..b50aa46329 100755
--- a/ext/threads/threads.xs
+++ b/ext/threads/threads.xs
@@ -601,7 +601,7 @@ Perl_ithread_join(pTHX_ SV *obj)
/* We have finished with it */
thread->state |= PERL_ITHR_JOINED;
MUTEX_UNLOCK(&thread->mutex);
- sv_unmagic(SvRV(obj),PERL_MAGIC_shared_scalar);
+
return retparam;
}
return (AV*)NULL;