summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Bergman <sky@nanisky.com>2001-10-24 13:18:07 +0000
committerArtur Bergman <sky@nanisky.com>2001-10-24 13:18:07 +0000
commitcd946ae2db3ce03071a574749334dedf51f8a29b (patch)
tree34a60dfadff54a7f84f52796c8859306251775a5
parent143014bf2594b56fdf762b3cf36b37c248c55291 (diff)
downloadperl-cd946ae2db3ce03071a574749334dedf51f8a29b.tar.gz
Add support for finding shared arrays and hashes.
p4raw-id: //depot/perl@12620
-rw-r--r--sharedsv.c24
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;
}