From: Artur Bergman Date: Wed, 24 Oct 2001 13:18:07 +0000 (+0000) Subject: Add support for finding shared arrays and hashes. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cd946ae2db3ce03071a574749334dedf51f8a29b;p=p5sagit%2Fp5-mst-13.2.git Add support for finding shared arrays and hashes. p4raw-id: //depot/perl@12620 --- diff --git a/sharedsv.c b/sharedsv.c index dde1153..e91d7b9 100644 --- a/sharedsv.c +++ b/sharedsv.c @@ -89,12 +89,24 @@ Perl_sharedsv_find(pTHX_ SV* sv) shared_sv* ssv = NULL; switch (SvTYPE(sv)) { case SVt_PVMG: - {MAGIC* mg = mg_find(sv, PERL_MAGIC_ext); - - if(strcmp(mg->mg_ptr,"threads::shared")) - break; - ssv = (shared_sv*) SvIV(mg->mg_obj); - } + case SVt_PVAV: + case SVt_PVHV: { + MAGIC* mg = mg_find(sv, PERL_MAGIC_ext); + if(mg) { + if(strcmp(mg->mg_ptr,"threads::shared")) + break; + ssv = (shared_sv*) SvIV(mg->mg_obj); + break; + } + + mg = mg_find(sv,PERL_MAGIC_tied); + if(mg) { + SV* obj = SvTIED_obj(sv,mg); + if(sv_derived_from(obj, "threads::shared")) + ssv = (shared_sv*) SvIV(SvRV(obj)); + break; + } + } } return ssv; }