aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/lang/Thread.java
diff options
context:
space:
mode:
authorBryce McKinlay <bryce@albatross.co.nz>2000-06-20 13:30:14 +0000
committerBryce McKinlay <bryce@gcc.gnu.org>2000-06-20 14:30:14 +0100
commit6dfd8a7790da2956f92e6abc1266206121f70388 (patch)
tree5edeb41dea7e82739902a97679205e7fb75f32d3 /libjava/java/lang/Thread.java
parent83fb52d8bb04d35f802af3c92a65669f259e3203 (diff)
downloadgcc-6dfd8a7790da2956f92e6abc1266206121f70388.zip
gcc-6dfd8a7790da2956f92e6abc1266206121f70388.tar.gz
gcc-6dfd8a7790da2956f92e6abc1266206121f70388.tar.bz2
ThreadGroup.java: Merged with classpath.
2000-06-20 Bryce McKinlay <bryce@albatross.co.nz> * java/lang/ThreadGroup.java: Merged with classpath. * prims.cc (_Jv_RunMain): Don't use ain_group'. * gnu/gcj/runtime/FirstThread.java: Remove ThreadGroup constructor argument. * java/lang/Thread.java (Thread): Bootstrap initial thread from ThreadGroup.root if Thread.currentThread is null. Honour the ThreadGroup's max priority setting. From-SVN: r34615
Diffstat (limited to 'libjava/java/lang/Thread.java')
-rw-r--r--libjava/java/lang/Thread.java27
1 files changed, 15 insertions, 12 deletions
diff --git a/libjava/java/lang/Thread.java b/libjava/java/lang/Thread.java
index 0d11337..8be7f60 100644
--- a/libjava/java/lang/Thread.java
+++ b/libjava/java/lang/Thread.java
@@ -198,19 +198,21 @@ public class Thread implements Runnable
public Thread (ThreadGroup g, Runnable r, String n)
{
- // Note that CURRENT can be null when we are creating the very
- // first thread. That's why we check it below.
Thread current = currentThread ();
-
- if (g != null)
+
+ if (g == null)
{
- // If CURRENT is null, then we are creating the first thread.
- // In this case we don't do the security check.
- if (current != null)
- g.checkAccess();
+ // If CURRENT is null, then we are bootstrapping the first thread.
+ // Use ThreadGroup.root, the main threadgroup.
+ if (current == null)
+ group = ThreadGroup.root;
+ else
+ group = current.getThreadGroup();
}
else
- g = current.getThreadGroup();
+ group = g;
+
+ group.checkAccess();
// The Class Libraries book says ``threadName cannot be null''. I
// take this to mean NullPointerException.
@@ -218,8 +220,7 @@ public class Thread implements Runnable
throw new NullPointerException ();
name = n;
- group = g;
- g.add(this);
+ group.add(this);
runnable = r;
data = null;
@@ -230,7 +231,9 @@ public class Thread implements Runnable
if (current != null)
{
daemon_flag = current.isDaemon();
- priority = current.getPriority();
+ int gmax = group.getMaxPriority();
+ int pri = current.getPriority();
+ priority = (gmax < pri ? gmax : pri);
}
else
{