'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
use Scalar::Util qw(reftype refaddr blessed);
-our $VERSION = '1.32';
+our $VERSION = '1.33';
my $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;
=head1 VERSION
-This document describes threads::shared version 1.32
+This document describes threads::shared version 1.33
=head1 SYNOPSIS
mentioned limitation. See F<examples/class.pl> (in the CPAN distribution of
this module) for how to create a class that supports object sharing.
-Does not support C<splice> on arrays!
+Does not support C<splice> on arrays. Does not support explicitly changing
+array lengths via $#array -- use C<push> and C<pop> 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
L<http://www.cpanforum.com/dist/threads-shared>
Annotated POD for L<threads::shared>:
-L<http://annocpan.org/~JDHEDDEN/threads-shared-1.32/shared.pm>
+L<http://annocpan.org/~JDHEDDEN/threads-shared-1.33/shared.pm>
Source repository:
L<http://code.google.com/p/threads-shared/>
{
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)) {
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)))