Thanks!  If you run the sample script below you will see that the
development branch of bash occasionally crashes with an Aborted..
message too.

Do you have an opinion on having a variant of wait, say "wait -", that
will simply wait for any job to complete and return it's exit status?
I know that you probably have to be selective about what features you
spend time on but I would be curious what you think about the idea.
This feature would make it simple to solve these naive parallelization
problems without signals and traps.


#!/bin/bash

count=0

function dummy
{
  usleep $RANDOM
}

set -m
trap ': $(( ++count ))' CHLD

for i in {1..1000}
do
  dummy $i &
done

wait

echo $count

Thanks,
-------
Elliott Forney

On Tue, Nov 6, 2012 at 11:30 AM, Chet Ramey <chet.ra...@case.edu> wrote:
> On 11/5/12 11:34 PM, Elliott Forney wrote:
>
>> Sorry, I should look before posting.  I cloned the latest devel branch
>> of bash and now I see the following occasionally but it may still be a
>> work in progress.
>>
>> $ ./trap_race
>> 4.2.37(3)-maint
>> register_alloc: 0x9779a8 already in table as allocated?
>> register_alloc: 0x979378 already in table as allocated?
>> 100
>
> That is a message from the debugging malloc that gets compiled in when
> you run a development build.  It is unrelated to any of the trap/wait
> changes, though it may indicate a possible memory leak.
>
> Chet
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
>                  ``Ars longa, vita brevis'' - Hippocrates
> Chet Ramey, ITS, CWRU    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to