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
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
stop() ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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();
}
}
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??
:)