"I'm not back." - Bill Harding, Twister
"I'm not back." - Bill Harding, Twister
Originally posted by Rahul Rathore:
Sorry for poking my nose in your query to Jim. But I happen to have the answer here. The answer is NO. This question has been specifically dealt with in the API documentation, and also discussed in many other posts.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
What if a thread doesn't respond to Thread.interrupt?
In some cases, you can use application specific tricks. For example, if a thread is waiting on a known socket, you can close the socket to cause the thread to return immediately. Unfortunately, there really isn't any technique that works in general. It should be noted that in all situations where a waiting thread doesn't respond to Thread.interrupt, it wouldn't respond to Thread.stop either. Such cases include deliberate denial-of-service attacks, and I/O operations for which thread.stop and thread.interrupt do not work properly.
"An InterruptedIOException is thrown to indicate that an input or output transfer has been terminated because the thread performing it was terminated"
Originally posted by Rahul Rathore:
I repeat the assertion that an interrupt will NEVER unblock a blocked thread eg. a thread blocked while doing read() from a socket stream.
Peter den Haan | peterdenhaan.com | quantum computing specialist, Objectivity Ltd
Don't get me started about those stupid light bulbs. |