From: Artur Bergman Date: Wed, 16 Apr 2003 16:27:43 +0000 (+0000) Subject: Fix double join problem for those places where free X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=57b48062fe99a8eadb0b080a32b9197986647f56;p=p5sagit%2Fp5-mst-13.2.git Fix double join problem for those places where free actually means free (solaris for example :) Fixes bug #16681 p4raw-id: //depot/perl@19240 --- diff --git a/ext/threads/t/join.t b/ext/threads/t/join.t index 28be717..054d0fe 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 1ad12a6..b50aa46 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;