From 3cf890fa53f887b309bb175ee175fa324ccc326c Mon Sep 17 00:00:00 2001 From: Steve Hannah Date: Thu, 19 Feb 2015 08:39:18 -0800 Subject: [PATCH] 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). --- .../java/org/teavm/classlib/java/lang/TThread.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TThread.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TThread.java index 807c74f3c..f50841b41 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TThread.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TThread.java @@ -35,6 +35,7 @@ public class TThread extends TObject implements TRunnable { private static long nextId = 1; private static int activeCount = 1; private long id; + private int priority = 0; private TString name; TRunnable target; @@ -64,7 +65,7 @@ public class TThread extends TObject implements TRunnable { try { activeCount++; setCurrentThread(TThread.this); - target.run(); + TThread.this.run(); } finally { activeCount--; setCurrentThread(mainThread); @@ -137,5 +138,13 @@ public class TThread extends TObject implements TRunnable { } }, millis); } + + public final void setPriority(int newPriority){ + this.priority = newPriority; + } + + public final int getPriority(){ + return this.priority; + } }