InterruptUtil interruptUtil = new InterruptUtil(context);
try {
interruptUtil.maskInterruptFlag();
someOtherThread.join(delay);
} catch (InterruptedException e) {
// reachable only if join does not succeed within delay.
// Without the maskInterruptFlag() call, the join() would have returned
// immediately
// had the current thread been interrupted previously, i.e. before entering
// the above block
} finally {
interruptUtil.unmaskInterruptFlag();
}
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void |
| previouslyInterrupted | back to summary |
|---|---|
| pack-priv final boolean previouslyInterrupted | |
| InterruptUtil | back to summary |
|---|---|
| public InterruptUtil(Context context) | |
| maskInterruptFlag | back to summary |
|---|---|
| public void maskInterruptFlag() | |
| unmaskInterruptFlag | back to summary |
|---|---|
| public void unmaskInterruptFlag() | |