This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Threads and Synchronization and the fly likes What exactly is Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "What exactly is "interrupt status"? " Watch "What exactly is "interrupt status"? " New topic

What exactly is "interrupt status"?

Sang-Wook Kim
Ranch Hand

Joined: Jan 07, 2004
Posts: 36

I am currently working with threads and I've just read the Javadoc

of "Thread.interrupt()" and it's written:

[If this thread is blocked in an invocation of the wait(), wait(long), or wait(long, int) methods of the Object class, or of the join(), join(long), join(long, int), sleep(long), or sleep(long, int), methods of this class, then its interrupt status will be cleared and it will receive an InterruptedException.

I am not sure what "its interrupt status will be cleared" exactly means.

The only thing I know is that this method stops the thread considering

the thread's condition. But I don't know what interrupt status means..

Could somebody plz explain about interrupt status?

Thanks in advance.

Hyung Kim
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24183

Thread contains a boolean member that serves as a flag. True means the Thread has been interrupted, and the flag hasn't been cleared yet. False is "normal". The Thread.isInterrupted() method returns the value of this flag.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: What exactly is "interrupt status"?
Similar Threads
interrupt doesn't interrupt?
Dan's Thread
Interrupting a Thread
MultiThreaded Programming: Killing Thread
Killing a process in sleep