[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: multi-threaded compiling
From: |
Mischa Baars |
Subject: |
Re: multi-threaded compiling |
Date: |
Mon, 11 Mar 2024 19:24:10 +0100 |
Hi Greg,
Good point. One for you :)
Cheerz,
Mischa.
On Mon, Mar 11, 2024 at 7:14 PM Greg Wooledge <greg@wooledge.org> wrote:
> On Mon, Mar 11, 2024 at 06:51:54PM +0100, Mischa Baars wrote:
> > SECONDS=5; for (( i=0;i<32;i++ )); do { exit ${i}; } & pid[${i}]=${!};
> done; sleep ${SECONDS}; for (( i=0;i<32;i++ )); do wait -n ${pid[${i}]};
> e=${?}; echo "$(printf %3u ${i}) pid ${pid[${i}]} exit ${e}"; done;
> > /bin/bash: line 1: wait: 1747087: no such job
> > 0 pid 1747087 exit 127
> > /bin/bash: line 1: wait: 1747088: no such job
> > 1 pid 1747088 exit 127
>
> Without analyzing this in depth, one thing struck me immediately:
> you're using the reserved variable SECONDS, which has special semantics
> in bash. ${SECONDS} is going to expand to an ever-increasing number,
> beginning with 5 (since that's the value you assigned), and going up
> by 1 per second that the script runs. I'm assuming that was not your
> intention.
>
> In general, any variable whose name is all capital letters *may* have
> special meaning to the shell and should not be used for general storage
> purposes in scripts.
>
- Re: multi-threaded compiling, (continued)
- Re: multi-threaded compiling, Chet Ramey, 2024/03/11
- Re: multi-threaded compiling, Mischa Baars, 2024/03/11
- Re: multi-threaded compiling, Greg Wooledge, 2024/03/11
- Re: multi-threaded compiling, Paul Smith, 2024/03/11
- Re: multi-threaded compiling, Mischa Baars, 2024/03/11
- Re: multi-threaded compiling, Greg Wooledge, 2024/03/11
- Re: multi-threaded compiling,
Mischa Baars <=
- Re: multi-threaded compiling, Mischa Baars, 2024/03/11
- Re: multi-threaded compiling, alex xmb sw ratchev, 2024/03/11
- Re: multi-threaded compiling, Paul Smith, 2024/03/11
Re: multi-threaded compiling, Martin D Kealey, 2024/03/12