You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by "Perrier, Nathan" <np...@ptc.com> on 2010/06/24 23:04:46 UTC

Atomic/Synchronized Task

Hello all,

 

I was curious if there exists a means to atomically execute tasks when
running targets in parallel.

 

I.E., I would like to do something like the following:

 

<target name="begin">

                <parallel>

                                <antcall target="one"/>

                                <antcall target="two"/>

                </parallel>

</target>

 

<target name="one">

...

                Do something in parallel

...

                <synchronized>

...

                                Do something atomically

...

                </synchronized>

...

</target>

 

<target name="two">

...

                Do something in parallel

...

                <synchronized>

...

                                Do something atomically

...

                </synchronized>

...

</target>

 


Re: Atomic/Synchronized Task

Posted by Matt Benson <gu...@gmail.com>.
On Jun 24, 2010, at 4:34 PM, Perrier, Nathan wrote:

> No, that's just a wrapper task that executes the subtasks it wraps in
> order.  It is not "thread-safe", which is what I am looking for.
> 
> Basically, what I'm looking for is a locking mechanism for certain tasks
> that can't run in parallel.
> 

Gotcha.  There is a little bit of discussion on dev@ant.apache.org about a parallel target executor implementation, and a similar effort a few years ago contained some notion of target exclusivity.  That's not task exclusivity, but it might behoove you to join in the development effort of the parallel executor (if its author is open to outside participation).  It could be close enough or lead to something that is.

HTH,
Matt

> 
> -----Original Message-----
> From: Matt Benson [mailto:gudnabrsam@gmail.com] 
> Sent: Thursday, June 24, 2010 4:24 PM
> To: Ant Users List
> Subject: Re: Atomic/Synchronized Task
> 
> 
> On Jun 24, 2010, at 4:04 PM, Perrier, Nathan wrote:
> 
>> Hello all,
>> 
>> 
>> 
>> I was curious if there exists a means to atomically execute tasks when
>> running targets in parallel.
>> 
> 
> <sequential> ?
> 
> -Matt
> 
>> 
>> 
>> I.E., I would like to do something like the following:
>> 
>> 
>> 
>> <target name="begin">
>> 
>>               <parallel>
>> 
>>                               <antcall target="one"/>
>> 
>>                               <antcall target="two"/>
>> 
>>               </parallel>
>> 
>> </target>
>> 
>> 
>> 
>> <target name="one">
>> 
>> ...
>> 
>>               Do something in parallel
>> 
>> ...
>> 
>>               <synchronized>
>> 
>> ...
>> 
>>                               Do something atomically
>> 
>> ...
>> 
>>               </synchronized>
>> 
>> ...
>> 
>> </target>
>> 
>> 
>> 
>> <target name="two">
>> 
>> ...
>> 
>>               Do something in parallel
>> 
>> ...
>> 
>>               <synchronized>
>> 
>> ...
>> 
>>                               Do something atomically
>> 
>> ...
>> 
>>               </synchronized>
>> 
>> ...
>> 
>> </target>
>> 
>> 
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Atomic/Synchronized Task

Posted by "Perrier, Nathan" <np...@ptc.com>.
No, that's just a wrapper task that executes the subtasks it wraps in
order.  It is not "thread-safe", which is what I am looking for.

Basically, what I'm looking for is a locking mechanism for certain tasks
that can't run in parallel.


-----Original Message-----
From: Matt Benson [mailto:gudnabrsam@gmail.com] 
Sent: Thursday, June 24, 2010 4:24 PM
To: Ant Users List
Subject: Re: Atomic/Synchronized Task


On Jun 24, 2010, at 4:04 PM, Perrier, Nathan wrote:

> Hello all,
> 
> 
> 
> I was curious if there exists a means to atomically execute tasks when
> running targets in parallel.
> 

<sequential> ?

-Matt

> 
> 
> I.E., I would like to do something like the following:
> 
> 
> 
> <target name="begin">
> 
>                <parallel>
> 
>                                <antcall target="one"/>
> 
>                                <antcall target="two"/>
> 
>                </parallel>
> 
> </target>
> 
> 
> 
> <target name="one">
> 
> ...
> 
>                Do something in parallel
> 
> ...
> 
>                <synchronized>
> 
> ...
> 
>                                Do something atomically
> 
> ...
> 
>                </synchronized>
> 
> ...
> 
> </target>
> 
> 
> 
> <target name="two">
> 
> ...
> 
>                Do something in parallel
> 
> ...
> 
>                <synchronized>
> 
> ...
> 
>                                Do something atomically
> 
> ...
> 
>                </synchronized>
> 
> ...
> 
> </target>
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Atomic/Synchronized Task

Posted by Matt Benson <gu...@gmail.com>.
On Jun 24, 2010, at 4:04 PM, Perrier, Nathan wrote:

> Hello all,
> 
> 
> 
> I was curious if there exists a means to atomically execute tasks when
> running targets in parallel.
> 

<sequential> ?

-Matt

> 
> 
> I.E., I would like to do something like the following:
> 
> 
> 
> <target name="begin">
> 
>                <parallel>
> 
>                                <antcall target="one"/>
> 
>                                <antcall target="two"/>
> 
>                </parallel>
> 
> </target>
> 
> 
> 
> <target name="one">
> 
> ...
> 
>                Do something in parallel
> 
> ...
> 
>                <synchronized>
> 
> ...
> 
>                                Do something atomically
> 
> ...
> 
>                </synchronized>
> 
> ...
> 
> </target>
> 
> 
> 
> <target name="two">
> 
> ...
> 
>                Do something in parallel
> 
> ...
> 
>                <synchronized>
> 
> ...
> 
>                                Do something atomically
> 
> ...
> 
>                </synchronized>
> 
> ...
> 
> </target>
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org