Cygwin: sigproc: Eliminate redundant copying of chld_procs
On PROC_EXEC_CLEANUP, the pinfo's in chld_procs are removed. This is done in a loop always removing the child with index 0. This, however, results in copying the last child's pinfo in chld_procs to position 0. Do this for 100 children and you get 99 entirely useless copy operations. Fix this by calling remove_proc in reverse order. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
bc9149b347
commit
e1ca36ff14
|
@ -299,8 +299,10 @@ proc_subproc (DWORD what, uintptr_t val)
|
|||
goto scan_wait;
|
||||
|
||||
case PROC_EXEC_CLEANUP:
|
||||
/* Cleanup backwards to eliminate redundant copying of chld_procs
|
||||
array members inside remove_proc. */
|
||||
while (chld_procs.count ())
|
||||
remove_proc (0);
|
||||
remove_proc (chld_procs.count () - 1);
|
||||
for (w = &waitq_head; w->next != NULL; w = w->next)
|
||||
CloseHandle (w->next->ev);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue