Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Java Interrupts

Name: Anonymous 2011-12-30 22:41

lets say I have the following code:

public void run()
{
  executeExternalLibraryCall();
}


and this is inside a class that extends Thread and implements Runnable.
For now assume executeExternalLibraryCall() basically goes into an infinite loop.

Now this whole process is being ran in another Thread via thread.start()...

I wish to interrupt it so that it stops execution of the external library call and returns from run thus destroying the thread, i thought about using thread.interrupt() on it but from what i've read online it seems that only works if the method were to throw InterruptedException which my external library call does not and i can't check for isInterrupted() while doing the external library call since it basically is an infinite loop so once called i lose all control in that thread.

How do i interrupt it to exit from that infinite loop in the external library call and return from run()?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List