diff options
author | Nicholas Clark <nick@ccl4.org> | 2005-10-25 12:54:18 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2005-10-25 12:54:18 +0000 |
commit | 7b9a32411c4ec6251e6f3ab9bb69dd43222d7692 (patch) | |
tree | 00db887945a5e94bc32b119a07b1ab42aea7934f /util.c | |
parent | 28ffa55a57d1b19a5f4e472983f2acf8c7c075ab (diff) | |
download | perl-7b9a32411c4ec6251e6f3ab9bb69dd43222d7692.tar.gz |
Code in wait4pid was calling hv_delete with the hash iterator
currently on that entry. On aggregate this does more work, beacuse
the next call to hv_iterinit() would spot the flag, and have to call
the delete routine, while in the meantime any new entries can't
re-use that memory.
p4raw-id: //depot/perl@25848
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -2661,6 +2661,13 @@ Perl_wait4pid(pTHX_ Pid_t pid, int *statusp, int flags) pid = atoi(hv_iterkey(entry,(I32*)statusp)); *statusp = SvIVX(sv); len = my_sprintf(spid, "%"IVdf, (IV)pid); + /* The hash iterator is currently on this entry, so simply + calling hv_delete would trigger the lazy delete, which on + aggregate does more work, beacuse next call to hv_iterinit() + would spot the flag, and have to call the delete routine, + while in the meantime any new entries can't re-use that + memory. */ + hv_iterinit(PL_pidstatus); (void)hv_delete(PL_pidstatus,spid,len,G_DISCARD); return pid; } |