diff options
author | Artur Bergman <sky@nanisky.com> | 2001-10-24 13:18:07 +0000 |
---|---|---|
committer | Artur Bergman <sky@nanisky.com> | 2001-10-24 13:18:07 +0000 |
commit | cd946ae2db3ce03071a574749334dedf51f8a29b (patch) | |
tree | 34a60dfadff54a7f84f52796c8859306251775a5 | |
parent | 143014bf2594b56fdf762b3cf36b37c248c55291 (diff) | |
download | perl-cd946ae2db3ce03071a574749334dedf51f8a29b.tar.gz |
Add support for finding shared arrays and hashes.
p4raw-id: //depot/perl@12620
-rw-r--r-- | sharedsv.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/sharedsv.c b/sharedsv.c index dde1153290..e91d7b97d9 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; } |