Fix double join problem for those places where free
authorArtur Bergman <sky@nanisky.com>
Wed, 16 Apr 2003 16:27:43 +0000 (16:27 +0000)
committerArtur Bergman <sky@nanisky.com>
Wed, 16 Apr 2003 16:27:43 +0000 (16:27 +0000)
actually means free (solaris for example :)
Fixes bug #16681

p4raw-id: //depot/perl@19240

ext/threads/t/join.t
ext/threads/threads.xs

index 28be717..054d0fe 100644 (file)
@@ -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");
+}
index 1ad12a6..b50aa46 100755 (executable)
@@ -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;