"Steve Horsley" <_SPAM.net> wrote in message
news

_SPAM .net...
> On Thu, 03 Jul 2003 23:23:54 -0700, Peter wrote:
>
> > Hi
> > I have a class that extend Thread. If i put this line
> > "thread.currentThread().sleep(1000);" into the "public void run()",
> > after i call interrupt(), the thread will stop.
> >
> > thanks
> > from Peter ()
>
> Do you have a question? If so, I suggest you post some code with it so
> others can see more clearly what you're on about.
I'm gathering that his question involves the fact that the thread is not
interrupted at the instant that interrupt is called on it. If that is the
question, then that is the way it is supposed to work.
It will only be interrupted when in a wait, join, sleep, or blocked in
certain I/O operations in the New I/O API. If it is not currently blocked
all that will happen is that the threads interrupted flag is set so that it
will be interrupted when it does do a blocking operation or you can also
query the status of the interrupt flag with the interrupted method (which
also clears the flag).
--
Dale King