summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1998-09-24 03:36:30 +0000
committerGurusamy Sarathy <gsar@cpan.org>1998-09-24 03:36:30 +0000
commit5f08fbcd6341ee0f8f3c7dfe721098c3bfae1c67 (patch)
treea70127e53b67320af4d734e666f8494d502244f6 /hv.c
parent34b5802582e6ac0ab95ef6940fa408896842b141 (diff)
downloadperl-5f08fbcd6341ee0f8f3c7dfe721098c3bfae1c67.tar.gz
provide locked access to string table for USE_THREADS
p4raw-id: //depot/perl@1863
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hv.c b/hv.c
index 40bb9b8e73..2416831256 100644
--- a/hv.c
+++ b/hv.c
@@ -1149,6 +1149,7 @@ unsharepvn(char *str, I32 len, U32 hash)
} */
xhv = (XPVHV*)SvANY(PL_strtab);
/* assert(xhv_array != 0) */
+ LOCK_STRTAB_MUTEX;
oentry = &((HE**)xhv->xhv_array)[hash & (I32) xhv->xhv_max];
for (entry = *oentry; entry; i=0, oentry = &HeNEXT(entry), entry = *oentry) {
if (HeHASH(entry) != hash) /* strings can't be equal */
@@ -1166,6 +1167,7 @@ unsharepvn(char *str, I32 len, U32 hash)
del_he(entry);
--xhv->xhv_keys;
}
+ UNLOCK_STRTAB_MUTEX;
break;
}
@@ -1193,6 +1195,7 @@ share_hek(char *str, I32 len, register U32 hash)
*/
xhv = (XPVHV*)SvANY(PL_strtab);
/* assert(xhv_array != 0) */
+ LOCK_STRTAB_MUTEX;
oentry = &((HE**)xhv->xhv_array)[hash & (I32) xhv->xhv_max];
for (entry = *oentry; entry; i=0, entry = HeNEXT(entry)) {
if (HeHASH(entry) != hash) /* strings can't be equal */
@@ -1219,6 +1222,7 @@ share_hek(char *str, I32 len, register U32 hash)
}
++HeVAL(entry); /* use value slot as REFCNT */
+ UNLOCK_STRTAB_MUTEX;
return HeKEY_hek(entry);
}