Change 12640 by sky@sky-borderline on 2001/10/25 10:18:23

        Fix threadcounts for arrays and hashes.

Affected files ...

... //depot/perl/ext/threads/shared/shared.pm#5 edit
... //depot/perl/ext/threads/shared/shared.xs#8 edit

Differences ...

==== //depot/perl/ext/threads/shared/shared.pm#5 (text) ====
Index: perl/ext/threads/shared/shared.pm
--- perl/ext/threads/shared/shared.pm.~1~       Thu Oct 25 04:30:06 2001
+++ perl/ext/threads/shared/shared.pm   Thu Oct 25 04:30:06 2001
@@ -63,6 +63,7 @@
 
 sub DESTROY {
     my $self = shift;
+    _thrcnt_dec($$self);
     delete($shared{$$self});
 }
 

==== //depot/perl/ext/threads/shared/shared.xs#8 (text) ====
Index: perl/ext/threads/shared/shared.xs
--- perl/ext/threads/shared/shared.xs.~1~       Thu Oct 25 04:30:06 2001
+++ perl/ext/threads/shared/shared.xs   Thu Oct 25 04:30:06 2001
@@ -99,7 +99,10 @@
 _thrcnt(ref)
         SV* ref
        CODE:
-        shared_sv* shared = Perl_sharedsv_find(aTHX, ref);
+        shared_sv* shared;
+       if(SvROK(ref))
+           ref = SvRV(ref);
+       shared = Perl_sharedsv_find(aTHX, ref);
         if(!shared)
            croak("thrcnt can only be used on shared values");
        SHAREDSvLOCK(shared);
@@ -121,6 +124,15 @@
            croak("thrcnt can only be used on shared values");
        Perl_sharedsv_thrcnt_inc(aTHX_ shared);
 
+void
+_thrcnt_dec(ref)
+        SV* ref
+        CODE:
+       shared_sv* shared = (shared_sv*) SvIV(ref);
+        if(!shared)
+           croak("thrcnt can only be used on shared values");
+       Perl_sharedsv_thrcnt_dec(aTHX_ shared);
+
 
 MODULE = threads::shared               PACKAGE = threads::shared::sv           
 
End of Patch.

Reply via email to