Thanks Pete,
got it working.
jim

----- Original Message -----
From: "Peter Donald" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, April 27, 2001 2:59 PM
Subject: Re: Waiting in a task thread


> At 02:43  27/4/01 +0100, Jim Downing wrote:
> >Hi all,
> >I'm having problems with a section of code in a custom task that attempts
to
> >stall execution for a period. My code uses
> >
> >Thread.currentThread().wait(sometime);
> >
> >but throws an IllegalMonitorStateException ("... a thread has attempted
to
> >wait on an object's monitor ... without owning the specified monitor. ")
> >when the task executes.
> >
> >What gives? Can I get round it?
>
> I think you are looking for sleep ... wait it a synchronisation primitive.
> To use it you would go
>
> Object o = ...;
>
> synchronized( o )
> {
>   o.wait( 1234 );
> }
>
> This would wait 1234 ms or until some one did a o.notify().
>
> Cheers,
>
> Pete
>
> *-----------------------------------------------------*
> | "Faced with the choice between changing one's mind, |
> | and proving that there is no need to do so - almost |
> | everyone gets busy on the proof."                   |
> |              - John Kenneth Galbraith               |
> *-----------------------------------------------------*
>
>
>

Reply via email to