Re: Should launching background jobs inside a loop cause a race conditio
From:
Chet Ramey
Subject:
Re: Should launching background jobs inside a loop cause a race condition?
Date:
Thu, 19 Dec 2024 10:19:13 -0500
User-agent:
Mozilla Thunderbird
On 12/19/24 8:14 AM, Pablo Repetto wrote:
Anyway, what I'm trying to figure out is whether I'm in a 'Starting a
"daemon" and checking whether it started successfully' situation, or
whether redirections into background jobs *should* happen before other
commands start running, and this is just a bug in bash and dash.
No, there is no guarantee this happens. Redirections are performed in the
child process, after the fork, and how those processes are scheduled and
run is up to the kernel.
If you want synchronization, you have to add something yourself.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/