diff options
author | Artur Bergman <sky@nanisky.com> | 2001-10-25 10:18:23 +0000 |
---|---|---|
committer | Artur Bergman <sky@nanisky.com> | 2001-10-25 10:18:23 +0000 |
commit | 866fba466aecf19a94010075e4c72ab79c952441 (patch) | |
tree | bb4b1c67a38fc56b9db1dfd5bca709ede0781476 | |
parent | 3cc54a1f49451ebc6892cc4fcfc3faf510b77181 (diff) | |
download | perl-866fba466aecf19a94010075e4c72ab79c952441.tar.gz |
Fix threadcounts for arrays and hashes.
p4raw-id: //depot/perl@12640
-rw-r--r-- | ext/threads/shared/shared.pm | 1 | ||||
-rw-r--r-- | ext/threads/shared/shared.xs | 14 |
2 files changed, 14 insertions, 1 deletions
diff --git a/ext/threads/shared/shared.pm b/ext/threads/shared/shared.pm index 3fec35670f..d928d26349 100644 --- a/ext/threads/shared/shared.pm +++ b/ext/threads/shared/shared.pm @@ -63,6 +63,7 @@ sub CLONE { sub DESTROY { my $self = shift; + _thrcnt_dec($$self); delete($shared{$$self}); } diff --git a/ext/threads/shared/shared.xs b/ext/threads/shared/shared.xs index bbc6e6ec1c..e2187d79e3 100644 --- a/ext/threads/shared/shared.xs +++ b/ext/threads/shared/shared.xs @@ -99,7 +99,10 @@ SV* _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 @@ thrcnt_inc(ref) 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 |