Fixed issue with running threads that don't explicitly include a runnable target (e.g. if they have been derived with their own run() method).

This commit is contained in:
Steve Hannah 2015-02-19 08:39:18 -08:00
parent 9300c07daf
commit 3cf890fa53

View File

@ -35,6 +35,7 @@ public class TThread extends TObject implements TRunnable {
private static long nextId = 1; private static long nextId = 1;
private static int activeCount = 1; private static int activeCount = 1;
private long id; private long id;
private int priority = 0;
private TString name; private TString name;
TRunnable target; TRunnable target;
@ -64,7 +65,7 @@ public class TThread extends TObject implements TRunnable {
try { try {
activeCount++; activeCount++;
setCurrentThread(TThread.this); setCurrentThread(TThread.this);
target.run(); TThread.this.run();
} finally { } finally {
activeCount--; activeCount--;
setCurrentThread(mainThread); setCurrentThread(mainThread);
@ -137,5 +138,13 @@ public class TThread extends TObject implements TRunnable {
} }
}, millis); }, millis);
} }
public final void setPriority(int newPriority){
this.priority = newPriority;
}
public final int getPriority(){
return this.priority;
}
} }