From: Steffen Mueller Date: Thu, 15 Apr 2010 13:24:57 +0000 (+0200) Subject: Upgrade to threads-shared-1.33 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1a3f0f1d129333944296d9bd29d1641e7de1a13e;p=p5sagit%2Fp5-mst-13.2.git Upgrade to threads-shared-1.33 --- diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index 5134cee..771aade 100755 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -1573,7 +1573,7 @@ use File::Glob qw(:case); 'threads::shared' => { 'MAINTAINER' => 'jdhedden', - 'DISTRIBUTION' => 'JDHEDDEN/threads-shared-1.32.tar.gz', + 'DISTRIBUTION' => 'JDHEDDEN/threads-shared-1.33.tar.gz', 'FILES' => q[dist/threads-shared], 'EXCLUDED' => [ qw(examples/class.pl shared.h diff --git a/dist/threads-shared/shared.pm b/dist/threads-shared/shared.pm index 72192bc..15e7a02 100644 --- a/dist/threads-shared/shared.pm +++ b/dist/threads-shared/shared.pm @@ -7,7 +7,7 @@ use warnings; use Scalar::Util qw(reftype refaddr blessed); -our $VERSION = '1.32'; +our $VERSION = '1.33'; my $XS_VERSION = $VERSION; $VERSION = eval $VERSION; @@ -187,7 +187,7 @@ threads::shared - Perl extension for sharing data structures between threads =head1 VERSION -This document describes threads::shared version 1.32 +This document describes threads::shared version 1.33 =head1 SYNOPSIS @@ -527,7 +527,8 @@ that the contents of hash-based objects will be lost due to the above mentioned limitation. See F (in the CPAN distribution of this module) for how to create a class that supports object sharing. -Does not support C on arrays! +Does not support C on arrays. Does not support explicitly changing +array lengths via $#array -- use C and C instead. Taking references to the elements of shared arrays and hashes does not autovivify the elements, and neither does slicing a shared array/hash over @@ -588,7 +589,7 @@ L Discussion Forum on CPAN: L Annotated POD for L: -L +L Source repository: L diff --git a/dist/threads-shared/shared.xs b/dist/threads-shared/shared.xs index 7c9526e..a1c6925 100644 --- a/dist/threads-shared/shared.xs +++ b/dist/threads-shared/shared.xs @@ -864,29 +864,32 @@ sharedsv_elem_mg_FETCH(pTHX_ SV *sv, MAGIC *mg) { dTHXc; SV *saggregate = S_sharedsv_from_obj(aTHX_ mg->mg_obj); - SV** svp; + SV** svp = NULL; ENTER_LOCK; - if (SvTYPE(saggregate) == SVt_PVAV) { - assert ( mg->mg_ptr == 0 ); - SHARED_CONTEXT; - svp = av_fetch((AV*) saggregate, mg->mg_len, 0); - } else { - char *key = mg->mg_ptr; - I32 len = mg->mg_len; - assert ( mg->mg_ptr != 0 ); - if (mg->mg_len == HEf_SVKEY) { - STRLEN slen; - key = SvPV((SV *)mg->mg_ptr, slen); - len = slen; - if (SvUTF8((SV *)mg->mg_ptr)) { - len = -len; + if (saggregate) { /* During global destruction, underlying + aggregate may no longer exist */ + if (SvTYPE(saggregate) == SVt_PVAV) { + assert ( mg->mg_ptr == 0 ); + SHARED_CONTEXT; + svp = av_fetch((AV*) saggregate, mg->mg_len, 0); + } else { + char *key = mg->mg_ptr; + I32 len = mg->mg_len; + assert ( mg->mg_ptr != 0 ); + if (mg->mg_len == HEf_SVKEY) { + STRLEN slen; + key = SvPV((SV *)mg->mg_ptr, slen); + len = slen; + if (SvUTF8((SV *)mg->mg_ptr)) { + len = -len; + } } + SHARED_CONTEXT; + svp = hv_fetch((HV*) saggregate, key, len, 0); } - SHARED_CONTEXT; - svp = hv_fetch((HV*) saggregate, key, len, 0); + CALLER_CONTEXT; } - CALLER_CONTEXT; if (svp) { /* Exists in the array */ if (SvROK(*svp)) { @@ -957,6 +960,12 @@ sharedsv_elem_mg_DELETE(pTHX_ SV *sv, MAGIC *mg) dTHXc; MAGIC *shmg; SV *saggregate = S_sharedsv_from_obj(aTHX_ mg->mg_obj); + + /* Object may not exist during global destruction */ + if (! saggregate) { + return (0); + } + ENTER_LOCK; sharedsv_elem_mg_FETCH(aTHX_ sv, mg); if ((shmg = mg_find(sv, PERL_MAGIC_shared_scalar)))