Link to home
Start Free TrialLog in
Avatar of yefig
yefig

asked on

Killing thread immediately

I want to kill a thread immediately -
I mean that it if I use the method interrupt() it's change a flag and it takes time until the thread recognize that he was interrupted. I want to kill the thread with minimum time.

Thanks
Yefi
Avatar of Ovi
Ovi

stop() ?
ASKER CERTIFIED SOLUTION
Avatar of Jod
Jod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
look at
http://web2.java.sun.com/docs/books/tutorial/post1.0/preview/threads.html

particularly look at this code,use the currentThread() method

public void run()
{
      Thread thisThread = Thread.currentThread();
      while (blinker == thisThread)
      {
            try
            {
                Thread.sleep(interval);
            }
            catch (InterruptedException e)
            {}
            repaint();
      }
}

What a points 123??

:)