diff options
author | Dominik <dominik@dominikschuermann.de> | 2012-03-09 16:27:29 +0100 |
---|---|---|
committer | Dominik <dominik@dominikschuermann.de> | 2012-03-09 16:27:29 +0100 |
commit | 8452fb62b7d80c297395a8d12acd55a0375bff44 (patch) | |
tree | a05f61cf17bb9c58dd4043b465c038b86a8dd685 /src/org/apg/PausableThread.java | |
parent | df6933bfb83e131f9ed66c35cfdb0cb6268bc480 (diff) | |
download | open-keychain-8452fb62b7d80c297395a8d12acd55a0375bff44.tar.gz open-keychain-8452fb62b7d80c297395a8d12acd55a0375bff44.tar.bz2 open-keychain-8452fb62b7d80c297395a8d12acd55a0375bff44.zip |
renaming whole package to org.apg to simplifiy name
Diffstat (limited to 'src/org/apg/PausableThread.java')
-rw-r--r-- | src/org/apg/PausableThread.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/org/apg/PausableThread.java b/src/org/apg/PausableThread.java new file mode 100644 index 000000000..87258d36c --- /dev/null +++ b/src/org/apg/PausableThread.java @@ -0,0 +1,35 @@ +package org.apg; + +public class PausableThread extends Thread { + private boolean mPaused = false; + + public PausableThread(Runnable runnable) { + super(runnable); + } + + public void pause() { + synchronized (this) { + mPaused = true; + while (mPaused) { + try { + wait(); + } catch (InterruptedException e) { + // ignore + } + } + } + } + + public void unpause() { + synchronized (this) { + mPaused = false; + notify(); + } + } + + public boolean isPaused() { + synchronized (this) { + return mPaused; + } + } +} |