On Monday, November 05, 2012 05:52:41 PM Elliott Forney wrote: > OK, I see in POSIX mode that a trap on SIGCHLD will cause wait to > unblock. We are still maintaining a counter of running jobs though so > it seems to me that there could race condition in the following line > > trap '((j--))' CHLD > > if two processes quit in rapid succession and one trap gets preempted > in the middle of ((j--)) then the count may be off. Is this possible? >
I believe that Bash guarantees the trap will run once for every child that exits, so it shoud be impossible for the count to become off. See: https://lists.gnu.org/archive/html/bug-bash/2012-05/msg00055.html I think you might be experiencing other known bugs. Chet pushed several wait/job related commits within the last few weeks. I haven't tested these yet. http://git.savannah.gnu.org/cgit/bash.git/tree/CWRU/CWRU.chlog?h=devel -- Dan Douglas