ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Martin <pjlmar...@gmail.com>
Subject Re: wait for background thread
Date Tue, 26 Jul 2005 18:04:24 GMT
Hi,

The idea is actually to do that entirely in java. It's for a task I
want to share, so I'd like to avoid asking users to call a waitfor...

Basically, I'd like to see how to make the forget task work in
non-daemon mode (ie, ant should not terminate until the background
thread finishes). The <forget> task sources are available here::
http://cvs.sourceforge.net/viewcvs.py/ant-contrib/ant-contrib/src/net/sf/antcontrib/process/ForgetTask.java?rev=1.3&view=markup

I actually don't understand why ant does not wait for the end of the
thread. Does ant automatically terminates all underlying running
threads when it exits? Is that something that changed in a recent
release of ant?

Regards,

Patrick

On 7/26/05, Jan.Materne@rzf.fin-nrw.de <Jan.Materne@rzf.fin-nrw.de> wrote:
> I would use a file as semaphore:
> - the background thread creates a file as last instruction
> - Ant uses <waitfor><available file=""/> for synchronizing
> 
> Jan
> 
> >-----Urspr√ľngliche Nachricht-----
> >Von: Patrick Martin [mailto:pjlmartin@gmail.com]
> >Gesendet: Dienstag, 26. Juli 2005 18:08
> >An: user@ant.apache.org
> >Betreff: wait for background thread
> >
> >Hello,
> >Writing an task, I want to run some stuff in a background
> >thread, and I need ant to wait until the background thread is
> >done before exiting.
> >I thought I would take example on the ant-contrib forget task,
> >but it seems that ant will exit even if the background thread is not
> >finished:
> >
> ><target name="test">
> >       <taskdef resource="net/sf/antcontrib/antlib.xml" />
> >       <forget daemon="false">
> >               <echo message="before wait" />
> >               <waitfor maxwait="5" maxwaitunit="second">
> >                       <isset property="dummy.property" />
> >               </waitfor>
> >               <echo message="after wait" />
> >       </forget>
> ></target>
> >
> >Here is the output:
> >
> >test:
> >     [echo] before wait
> >
> >BUILD SUCCESSFUL
> >Total time: 0 seconds
> >
> >I tested with the daemon attribute set to true and false. Same thing.
> >
> >What is the recommended way to run tasks in background and
> >ensure they will be executed before the exit of ant ?
> >
> >Thank you,
> >
> >Patrick
> >
> >---------------------------------------------------------------------
> >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


Mime
View raw message