[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is there any mutex/semaphore mechanism in shell scripts?
From: |
pk |
Subject: |
Re: Is there any mutex/semaphore mechanism in shell scripts? |
Date: |
Thu, 21 May 2009 17:00:45 +0200 |
On Wednesday 20 May 2009 21:34, jjjaime wrote:
>
> I would like to execute some functions in parallel, but the last method
> has to wait until the first 2 functions have finished.
>
> The script is:
>
> FUNCTION_1() {
> ...
> }
> FUNCTION_2() {
> ...
> }
> FUNCTION_3() {
> ...
> }
> FUNCTION_1 &
> FUNCTION_2
> FUNCTION_3
>
> So, to speed up the execution of the script, I want FUNCTION_1 and
> FUNCTION_2 in parallel. But the script fails when FUNCTION_2 ends before
> FUNCTION_1.
>
> Is there any mechanism for synchronization (i.e. semaphores/mutes) or any
> other suggestion for simulating it?
Please see
http://cfaj.freeshell.org/shell/cus-faq.html#8