img
. . . . . .
This returns the value of the interrupt flag for the current thread and clears it.
Reference:
Chapter 9.
isInterrupted
public boolean isInterrupted()
This returns the value of the interrupt flag for the thread.
Reference:
Chapter 9.
Comment:
You will probably never use this.
The Class Extensions.InterruptibleThread
This is one of the classes that we defined for this topic to provide a consistent interface for dealing
with certain problems. Some of those problems are artificial, a product of trying to write uniform
example code in both POSIX and Java.
exit
public void exit()
This causes the current thread to exit. This is just syntactic sugar for:
Thread.currentThread().stop().
Reference: Chapter 4.
Comments: This is not the right way to do things. Don't exit from threads; return from the
run() method, instead.
interrupt
public void interrupt()
This causes the target thread to throw an InterruptedException as soon as it executes an
interruptible method when interrupts are enabled. If disabled at the time, the actual interrupt will
be issued as soon as the interrupts are reenabled.
Chapter 9.
Reference:
disableInterrupts
public void disableInterrupts()
This causes the current thread to set a flag indicating that it is not interruptible. The method
interrupt() will look at this.
Reference:
Chapter 9.
enableInterrupts
public void enableInterrupts()
This causes the current thread to set a flag indicating that it is interruptible. The method
interrupt() will look at this. If the flag indicates a pending interrupt, that interrupt will be
reissued at this time.
Chapter 9.
Reference:
Search WWH :
Custom Search
Previous Page
Multithreaded Programming with JAVA - Topic Index
Next Page
Multithreaded Programming with JAVA - Bookmarks
Home