bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: multi-threaded compiling


From: Greg Wooledge
Subject: Re: multi-threaded compiling
Date: Mon, 11 Mar 2024 14:29:49 -0400

On Mon, Mar 11, 2024 at 07:22:39PM +0100, Mischa Baars wrote:
> On Mon, Mar 11, 2024 at 6:22 PM alex xmb sw ratchev <fxmbsw7@gmail.com>
> wrote:
> 
> > i also completly dont get ur issue
> >
> > f=( a.c b.c .. ) threads=$( nproc ) i=-1 r=
> >
> >   while [[ -v f[++i] ]] ; do
> >  (( ++r > threads )) &&
> > wait -n
> > gcc -c "${f[i]}" &
> >   done
> >
> 
> How nice!
> 
> wait -n exit 1 & echo $?
> 
> You got me the solution :) Except that wait expects a pid after -n.

No, wait -n without a PID waits for any one job to complete.

hobbit:~$ sleep 123 & sleep 234 & sleep 3 & wait -n
[1] 513337
[2] 513338
[3] 513339
[3]+  Done                    sleep 3
hobbit:~$ ps
    PID TTY          TIME CMD
   1138 pts/0    00:00:00 bash
 513337 pts/0    00:00:00 sleep
 513338 pts/0    00:00:00 sleep
 513341 pts/0    00:00:00 ps
hobbit:~$ 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]