renaming whole package to org.apg to simplifiy name
This commit is contained in:
35
src/org/apg/PausableThread.java
Normal file
35
src/org/apg/PausableThread.java
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user