Re: wait unblocks before signals processed

2012-11-05 Thread Elliott Forney
> 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 guess my question is "can more than one trap run simultaneously?" The more I think

Re: wait unblocks before signals processed

2012-11-05 Thread Dan Douglas
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

Re: wait unblocks before signals processed

2012-11-05 Thread Elliott Forney
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 i

Re: wait unblocks before signals processed

2012-11-05 Thread Dan Douglas
Hi Elliott. The behavior of wait differs depending upon whether you are in POSIX mode. Try this script, which I think does essentially what you're after (also here: https://gist.github.com/3911059 ): #!/usr/bin/env bash ${BASH_VERSION+shopt -s lastpipe extglob} if [[ -v .sh.version ]]; then

Re: wait unblocks before signals processed

2012-11-05 Thread Elliott Forney
Of course, this code probably also has a race condition around --nrunning which makes it even less usable. Thanks, --- Elliott ForneyE-Mail: id...@cs.colosetate.edu On Mon, Nov 5, 2012 at 4:33 PM, Elliott Forney wrote: > While trying to modify some code I found on an

wait unblocks before signals processed

2012-11-05 Thread Elliott Forney
While trying to modify some code I found on an earlier post for running N jobs in parallel I came across the interesting behavior illustrated below. It appears that the wait command proceeds before my SIGUSR's are all processed. Is this a bug or just a fact of life? I understand that it isn't pos